Use Request Handlers To Mock Data Fetching Tests

TopicSource
๐Ÿงฉ ReactReact Testing Library and Jest: The Complete Guide - Udemy

Request handlers only intercept the actual request you are doing (e.g. axios or fetch) and return some mock data instead of sending the request. This allows you to test all code except the actual request, which makes it superior to module mocking.


  1. Module mocking is a bad way to test data fetching