Go Pro Sign Up Login
0 days 0 hrs 0 min 0 sec

Summer Sale

50% off Level Up Pro until you unsubscribe.
Get access to ALL 128 courses on Level Up Tutorials

This is your last chance to get Level Up Pro for $145/year.

or Learn More
Moon Moon

Buy Now and unlock this series




yours forever

Become a Pro and unlock everything




per month

Mocking Fetch Part 2 Async Tests & Working With Data

We are going to continue mocking fetch and begin working with async tests to make sure all of our Movie data is coming in correctly.


Become a pro to download code and videos



almost 2 years ago [edited]

waitForElement is deprecated, you can just use waitFor

if you get an error when using testing-library v11

TypeError: MutationObserver is not a constructor

See this GitHub issue, to fix it https://github.com/testing-library/dom-testing-library/issues/477#issuecomment-598606649

User avatar


about 2 years ago

@waitForElement() is deprecated That's perfect


about 2 years ago

Can you help in how to test the <MovieWrapper backdrop={${BACKDROP_PATH}${movie.backdrop_path}}>?

How do I test for backdrop?

waitForElement() is deprecated

over 2 years ago [edited]

As such, I used:

await waitFor(() => expect(fetch).toHaveBeenCalledTimes(1));

Downside to that?

Want to join the conversation?

Become a Pro member today!