- Create a GitHub repo with this starter code
- Clone the repo to your local computer
- npm install
- create .env and add your own MongoDB Atlas connection string, then use the environment variable on connection.js
- Create a new branch 'unittest'
- write App.test.js the most simple example
import { render, screen } from '@testing-library/react';
import App from './App';
import '@testing-library/jest-dom';
test('renders GetToDoItem component', () => {
render(<App />);
const linkElement = screen.getByText('My To Do Items');
expect(linkElement).toBeInTheDocument();
});
- run npm test
- commit and push
- Bonus(optional) - use fireEvent, waitFor
On GitHub 10. Create new workflow to run the test on PR to main 11. Make a PR to confirm the test runs on PR 12. Take a screenshot of the page showing the 'Test Passed' 12. Make sure it's merged to main
- Submit the screenshot and a short comment about this exercise