I have been trying to test redux's ConnectedComponent. But I can't get along with it. When I pass the store to a ConnectedComponent as a store prop I get this error:
Invariant Violation: Passing redux store in props has been removed and does not do anything. To use a custom Redux store for specific components, create a custom React context with React.createContext(), and pass the context object to React-Redux's Provider and specific components like: . You may also pass a {context : MyContext} option to connect
My test:
const store = storeFactory({ success: true });
test('renders component without error', () => {
const wrapper = shallow(<Input store={store} />);
expect(wrapper.props()).toBe({});
});
I use a helper function that creates a store:
export const storeFactory = initialState => {
return createStore(rootReducer, initialState);
};
I use this versions of packages:
"react-redux": "^6.0.0",
"redux": "^4.0.1",
"enzyme": "^3.8.0",
"enzyme-adapter-react-16": "^1.7.1",
"enzyme-redux": "^0.2.1",
"jest": "^23.6.0",
"jest-enzyme": "^7.0.1"
I don't know how to test ConnectedComponent. Please, if you have any solutions or suggestions for this situation share it with me))