1. storybook-addon-mock
A storybook addon to mock fetch/XHR request
storybook-addon-mock
Package: storybook-addon-mock
Created by: nutboltu
Last modified: Mon, 15 Apr 2024 05:11:10 GMT
Version: 5.0.0
License: MIT
Downloads: 639,555
Repository: https://github.com/nutboltu/storybook-addon-mock

Install

npm install storybook-addon-mock
yarn add storybook-addon-mock
Storybook addon mock

Storybook Addon Mock

Actions Status Npm download npm version License

NPM

This addon allows you to mock fetch or XMLHttprequest requests in storybook.
If your component depends on backend requests, and your backend requests are not ready yet to feed your component,
this addon provides mock response to build your component.

Purpose

There are few packages those help the developers to mock the backend requests while building components.
But those packages aren't integrated properly in storybook and also there's no scope to play with those requests in the storybook.
Mostly, there's no playground to modify the response and see the changes in the storybook.

Highlights

storybook-addon-mock provides the following features.

  • You can mock fetch or XMLHttpRequest.
  • A dedicated panel where you can see the list of mock requests.
  • An on/off button for each request which can turn off the mock and try the real request.
  • A dropdown list of status code where you can change the status and experience the difference.
  • A response JSON object which can be modified in the panel. You can see the changes straight away in the story.
  • A delay option which helps you delaying the response so that you can test any kind of loading behaviour.

Documentation

See the documentation

Older(2.*) version documentation

License

This project is licensed under the MIT License - see the LICENSE file in the source code for details.

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin