Skip to content
RED SAGSkills
medium10 pts · first answer countsreact-testing-librarytesting

Test fails before data arrives

A component fetches users after mount (mocked in the test). This assertion fails with "Unable to find an element", but the app works in the browser. What is the fix?

render(<UserList />)
expect(screen.getByText('Ana')).toBeInTheDocument()
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions