Skip to content

Commit

Permalink
Merge pull request #11 from Moujuruo/auto_workflow
Browse files Browse the repository at this point in the history
feat: 增加github CI/CD测试
  • Loading branch information
Moujuruo authored May 23, 2024
2 parents 9b12cfc + 2117c26 commit 6a66a56
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
File renamed without changes.
24 changes: 24 additions & 0 deletions .github/workflows/frontend-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# .github/workflows/nodejs-app.yml
name: Node.js application test

on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: 14.x
- name: Install dependencies
run: |
cd frontend
npm install
- name: Run tests
run: |
cd frontend
npm test
9 changes: 7 additions & 2 deletions frontend/src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
window.matchMedia = window.matchMedia || function() {
return {
matches : false,
addListener : function() {},
removeListener: function() {}
};
};
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';

test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});

0 comments on commit 6a66a56

Please sign in to comment.