Question: Is it valid to test Redux-Form components?
See original GitHub issueI’m having a little trouble when I try to test a Redux-Form component in the storybook. The error I get is
Uncaught Invariant Violation: Could not find "store" in either the context or props of "Connect(ReduxForm(SimpleForm))". Either wrap the root component in a <Provider>, or explicitly pass "store" as a prop to "Connect(ReduxForm(SimpleForm))".
Which I imagine is because there’s no <Provider store={store}>
wrapping the storybook root. What I first want to check is if this is a valid use case for the story book, and if so, what the suggested best approach would be for getting redux-form to play nice in the storybook.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:6
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Testing reduxForm component methods with jest and enzyme
I'm testing a reduxForm component with jest and enzyme and I don't know how i can test methods within this component.
Read more >Unit and Integration Testing of React/Redux Forms
Testing is an important part of any development process, but no single test will give you all the answers you need.
Read more >Field-Level Validation Example - Redux Form
If the value is valid, the validation function should return undefined . If the value is invalid, the validation function should return an...
Read more >Managing Form State in React With Redux Form - DigitalOcean
redux-form has the following components to help you build your ... we check if it's empty and also check if it's a valid...
Read more >Testing React Components with Jest and Enzyme- In Depth
Don't take for testing, for example, 'array' field, if you are not sure how to test 'text' field; don't take components decorated with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
also if anyone is having issues with the redux provider not being able to hot load, put it in another file than your
config.js
file like this:config.js:
Provider.js:
That way when your
config.js
file hot reloads it doesn’t have to hot reload your reduxProvider
“on the fly.”for those getting React.Children.only you can wrap your provider output in a div to address the issue
<div>{story}</div>