# All channels
Sachin D. Shinde@sachin-shinde
Why use MockedProvider when I can spyOn 'useQuery'?
After struggling for hours on implementing MockedProvider into my test setup (it is still not working and query results are undefined) I was asking myself why to use the MockedProvider in the first place and not just provide a mocked return value for the useQuery…
What is the proper way to wait for reactive variables in tests?
I asked a question on StackOverflow with all the details and examples: Can someone have a look and answer the thread? https://stackoverflow.com/questions/63880395/what-is-the-proper-way-to-wait-for-reactive-variables-in-tests
UseQuery with @client and reactive var doesn't work with MockedProvider
Mocking queries which use @client directive and are defined in MemoryCache using reactive variables doesn't return anything when using MockedProvider. How are you now supposed to mock queries, there is no documentation on this. This also all used to work before upgrading to v3…
How to mock local state client query?
I'm writing some tests using Jest and react-testing-library. All my mocks are working just fine, except when I try to mock a @client query. It always returns an empty object. When I remove the @client directive, the test passes just fine, but then I get console errors on my…
How to unit test the ApolloProvider from @apollo/react-hooks queries using…
When using MockedProvider in tests, I get the below error is there a different MockedProvider test-utils to test the version of the hooks? Currently, I'm testing it using with the below workaround …
Mockedprovider returning duplicate elements during pagination
Hey folks, I wrote a pagination hook using Apollo client and I'm seeing duplicated elements in my tests. Basically I'm trying to click forward and then back, and assuming the output should be one, then two, then one. instead I'm getting one, two, one one two: repro is here:…
Testing Local Cache Update
Not sure if this is the right place to post this question. Does anyone have an example of how to test a delete mutation which updates cache with read query and write query and removed one item from the cache. I am passing the cache to the MockProvider but i keep seeing error…
How can I spyOn the Mutation function that is called?
My react component calls the GQL Mutation hook when a form is submitted. The onSubmit is part of a renderProp in Formik so I don't have access to this function. Once it's submitted, the component unmounts. Rather than mock the data returned and test the E2E flow, I find it more…