Please don't mock SWR, Fetch or Axios in your unit/integration tests.
In this video you will learn how to test components that use "useSWR" without doing jest.mock("swr") or jest.mock("axios") or jest.spyOn(window, 'fetch') in order to give you more confidence on your tests :)
We are going to use MSW (Mock Service Worker) in order to mock the HTTP call itself, not your favorite fetching library
Top comments (2)
A huge help, Bruno! Loving this series, and some of the best out there for React testing! This area has a HUGE void, and Iβm glad youβre filling it!
Thank you Braydon :)