Enzyme helpers for testing Redux connected components.
Using Yarn:
yarn add enzyme-redux-helpers -D
Using npm:
npm install enzyme-redux-helpers --save-dev
Requires Enzyme 3.0.0+ as a peer dependency to work.
import { connectedMount } from 'enzyme-redux-helpers'
describe('<MyConnectedComponent />', () => {
it('renders correctly using the passed state', () => {
const mockStore = createMockReduxStore({ state: 'foo' })
const wrapper = connectedMount(<MyComponent />, mockStore);
// expect(wrapper.find(SubComponent)).to.have.length(1);
});
This package contains the following methods as named exports:
Returns the Enzyme wrapper instance for the mounted React element.