harblaith7/React-Testing-Library-Net-Ninja

FollowersList test is not working.

Opened this issue · 0 comments

In the 06-Mocking-Async-Request branch the test to the FollowersList component this test case should fetch and render input element is not working.
The line const followerDivElement = await screen.findByTestId('follower-item-0') gives an error that Unable to find an element by: [data-testid="follower-item-0"].

This error can be removed by using the waitfor syntax.

Just add the line await waitFor(() => screen.findByTestId('follower-item-0'));

Here is the link to the stack overflow problem https://stackoverflow.com/questions/67300260/how-would-i-test-this-using-jest-react-testing-library