Redux
Last updated
Was this helpful?
Last updated
Was this helpful?
This plugin sets up react-redux
context to test components that are connect()
ed to redux.
Setup required peer dependencies: , , , , and .
Install via yarn or npm
Add to plugins:
After adding the plugin to your mount
/shallow
, it can be used in your tests like so:
reduxContext(options) => EnzymePlugin
options
(Object
):
options.createStore
(() => Store
): a function which must return a redux store
EnzymePlugin
: The plugin which can be passed to createMount
/createShallow
.
This plugin also allows some configuration to be passed at mount-time:
initialActions
(Action[]
[optional]): an array of initial actions to be dispatched before the component is mounted. Useful to get the redux state into a desired form before the component initializes.
Example: