storybook-addon-mock icon indicating copy to clipboard operation
storybook-addon-mock copied to clipboard

Allow any defined response value

Open prichey opened this issue 1 year ago • 1 comments

The response validator as written fails for valid JSON (e.g. null, "foo", true, etc.). If the validator is going to enforce valid JSON, it should allow all JSON values, not just some. Furthermore, in my opinion this package shouldn't be concerned with validating a user-provided response, perhaps other than asserting that it is defined. Some APIs return invalid JSON - this package should support mocking those, too.

My changes here relax the response validation to merely asserting that it is not undefined. One could argue that undefined should be allowed too, but in this PR I'm only interested in permitting any defined value.

This PR would supersede https://github.com/linearlabs-workspace/storybook-addon-mock/pull/201 and close https://github.com/linearlabs-workspace/storybook-addon-mock/issues/200

prichey avatar Jul 09 '24 14:07 prichey

Deploy Preview for storybook-addon-mock ready!

Name Link
Latest commit b80aafcb5208e297b50973fad1c2b2de3214e780
Latest deploy log https://app.netlify.com/sites/storybook-addon-mock/deploys/668d4b7a0faead000802049c
Deploy Preview https://deploy-preview-214--storybook-addon-mock.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Jul 09 '24 14:07 netlify[bot]

For posterity: msw-storybook-addon supports this and is regularly maintained

prichey avatar Aug 29 '24 14:08 prichey