skip to content
Avatar Bruno Garcia

Workshop about Mock Service Worker

This is a workshop I made on Wallbox about Mock Service Worker.

I made this workshop after using Mock Service Worker on a project.

I wanted to share my experience with the team and also to have a reference for the future.

What is Mock Service Worker?

Mock Service Worker is a library that allows you to mock the API responses.

It is a library that runs in the browser and intercepts the requests to the API. It is able to mock the responses and also to delay them.

Good things about Mock Service Worker 👍

  • The front-end team is able to work on resources than still do not exist on the Real API.
  • The front-end team are able to test complete use cases.
  • The same set of mock data can be used for development, integration & units tests, and storybook.
  • The mock data is centralized and better organised.

Bad things about Mock Service Worker 👎

  • The front-end team must create a mock of the Real API.
  • The API Mock should be synchronized with the Real API.
  • Sometimes is hard to figure out how works the tests.
  • The test files and the mock files are stored in different folders.