[ad_1]
I'm using apollo-react and test with jest/enzyme. I want to test a component which includes another component which is wrapped in apollo-react HOC.
However it prints following error because it is not wrapped in ApolloProvider when being tested:
Invariant Violation: Could not find "client" in the context of "Apollo(MyComponent)". Wrap the root component in an
I is there anyway to ask apollo-react HOC to do do nothing (like skip: true) when it is not in ApolloProvider?
(I'm using enzyme's mount instead of shallow, because it is required to test other functionalities of the component.)
[ad_2]
لینک منبع