Skip to content

Instantly share code, notes, and snippets.

@nottyo
Created February 25, 2022 12:34
Show Gist options
  • Save nottyo/a19296e45040bdccb72fe9058c178a93 to your computer and use it in GitHub Desktop.
Save nottyo/a19296e45040bdccb72fe9058c178a93 to your computer and use it in GitHub Desktop.
RTL - Queries
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