I was getting error : Invariant Violation: Could not find "client" in the context of Query or as passed props. Wrap the root component in an
then I wrapped component in apollo provider with prop client while testing.
TypeError: this.client.watchQuery is not a function
732 |
733 | it('should close the overlay when the close button is clicked', () => {
> 734 | const mandateBatchWrapper = mount(
735 | <ApolloProvider client={clientForApollo}>
736 | <MandateBatch
737 | data={data}
Your ApolloClient might be mocked. If you have a file __mocks__/apollo-client.js
somewhere, ApolloClient will be mocked even without calling jest.mock('apollo-client')
. https://jestjs.io/docs/en/manual-mocks#mocking-node-modules.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With