Skip to content
Discussion options

You must be logged in to vote

To add tests:
1. Open tests/notes.test.js or create it.
2. Write a test using Jest:
javascript<br>import { render, fireEvent } from '@testing-library/react';<br>test('find and replace updates text', () => {<br> const { getByTestId } = render(<NotesApp />);<br> fireEvent.change(getByTestId('find-input'), { target: { value: 'test' } });<br> fireEvent.click(getByTestId('replace-button'));<br> expect(getByTestId('editor')).toHaveTextContent('replaced');<br>});<br>
3. Mock AuthContext if needed (see recent tests commit).
4. Run npm test.
5. Submit a pull request.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dailker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
help wanted Extra attention is needed question Further information is requested
2 participants