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

$

39

.99

yours forever

Become a Pro and unlock everything

$

24

.99

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.

Downloads

Become a pro to download code and videos

Comments

Alex

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

Raul

about 2 years ago

@waitForElement() is deprecated That's perfect

JC

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!