richie
richie copied to clipboard
Storybook - Use `storybook-addon-mock` to mock request with ease
Feature Request
Is your feature request related to a problem or unsupported use case? Please describe.
We are currently using FetchMock interface, to mock our requests into our Storybook. It has main drawbacks as it mocks the global fetch interface that cause all requests to fail. e.g: It intercepts icons.html file loading did in .storybook/preview.tsx.
Furthermore, mock our routes within Story is not pretty readable.
Describe the solution you'd like
Several addons has been developed to mock request with ease into Stories. The most popular and well maintain addon currently is storybook-addon-mock
Discovery, Documentation, Adoption, Migration Strategy
- https://storybook.js.org/integrations/tag/fetch-mock
- https://www.npmjs.com/package/storybook-addon-mock
- https://www.npmjs.com/package/storybook-addon-fetch-mock