As in the topic I am trying to test component with redux, here is the code:
describe.only("render testing", () => {
it("renders correctly select component", () => {
const wrapper = renderer
.create(
<RecoilRoot>
<Provider store={store}>
<Component />
</Provider>
</RecoilRoot>
)
.toJSON();
expect(wrapper).toMatchSnapshot();
});
});
the problem is that I of course get this error:
Invariant Violation: Could not find "store" in either the context or props of "Connect(Component)". Either wrap the root component in a <Provider>, or explicitly pass "store" as a prop to "Connect(Component)".
I made same testing for components without redux and it worked. What is wrong here? Should I test components with redux and HOC around them in a different way?
Aucun commentaire:
Enregistrer un commentaire