Mock Service Worker usage example with Angular.
- Describe the network behavior in
src/mocks/handlers.ts
.
- Create
src/mocks/browser.ts
and configure theworker
instance. - In
src/main.ts
, start the worker instance. Defer your application's rendering by implementing aprepareApp()
function.
If you are using Jest, make sure to provide jest-fixed-jsdom
as the custom testEnvironment
in your jest.config.js
file.