Skip to content

MediumConceptFrontend testing and tooling

How do you mock network requests in tests?

What a good answer covers

Use a tool such as Mock Service Worker to intercept requests at the network level so the same handlers work in tests and in development, rather than mocking fetch in each test.

More on Frontend testing and tooling

Flashcards for this topic