Created
February 25, 2022 12:34
-
-
Save nottyo/a19296e45040bdccb72fe9058c178a93 to your computer and use it in GitHub Desktop.
RTL - Queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('ESLint', () => { | |
it('renders title', async () => { | |
render(<Parent />); | |
// Do not do this | |
await waitFor(() => { | |
expect(screen.getByText('title')).toBeInTheDocument(); | |
}); | |
// using waitFor() + getBy* queries | |
// use findBy* queries instead | |
expect(await screen.findByText('title')).toBeInTheDocument(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment