Don't Mock Fetch (or Axios): Use Mock Service Worker and Test Like a User
Leigh Halliday
0:00 / 0:00
Don't Mock Fetch (or Axios): Use Mock Service Worker and Test Like a User
47 702 просмотра · 6 л. назад
Leigh Halliday
31,7 тыс. подписчиков
47 702 просмотра · 6 л. назад
Despite having launched a video showing how to mock both Fetch and Axios recently... here is another solution, the one recommended by Kent C. Dodds (creator of React Testing Library), showing how to use Mock Service Worker to avoid making actual HTTP requests when you are running your tests.
Code
https://github.com/leighhalliday/msw-...
Library
https://mswjs.io/
Join me on Discord! / discord