title: Example of how to test a component that uses useQuery?
body: <p>I have a React component that uses the Apollo hooks lib's <code>useQuery</code> hook. I'm having trouble testing this component. Here is my current setup. </p>
  
  <pre><code>import React from 'react';
  import { BrowserRouter as Router } from 'react-router-dom';
  import DashboardBar from './DashboardBar';
  import { render, cleanup } from '@testing-library/react';
  import { QUERY } from '../../queries';
  import { ApolloClient } from 'apollo-client';
  import { ApolloProvider as ApolloHooksProvider } from '@apollo/react-hooks';
  import { MockedProvider } from 'react-apollo/test-utils';
  import { InMemoryCache } from 'apollo-cache-inmemory';
  import { MockLink } from 'apollo-link-mock';
  import wait from 'waait';
  import casual from 'casual';
  
  describe('&lt;DashboardBar /&gt;', () =&gt; {
    it('renders and matches snapshot', async () =&gt; {
      const mocks = [
        {
          request: { query: QUERY, variables: { id: 'WLYhM' } },
          result: {
            data: {
              q: {
                brand: fakeBrand,
                claimByAction: casual.boolean,
                claimRules: fakeClaimRules,
                wantIn: fakeWantIn,
              },
            },
          },
        },
      ];
  
      function createClient(mocks) {
        return new ApolloClient({
          cache: new InMemoryCache(),
          link: new MockLink(mocks),
        });
      }
  
      const client = createClient(mocks);
  
      const { container } = render(
        &lt;ApolloHooksProvider client={client}&gt;
          &lt;Router&gt;
            &lt;DashboardBar {...props} store={reduxStore.store} /&gt;
          &lt;/Router&gt;
        &lt;/ApolloHooksProvider&gt;
      );
  
      console.log(container.firstChild);
      expect(container.firstChild).toBe(null);
  
      await wait(200);
  
      console.log(container.firstChild);
    });
  });
  </code></pre>
  
  <p>When I run the test, I'm getting the following error </p>
  
  <p><code>TypeError: Cannot read property 'q' of undefined</code></p>
  
  <p>Even though the data is being returned fine in the actual component. </p>
  
  <p>Does anyone have an example of how the successfully set up and executed tests w/ components using hooks from the Apollo hooks lib?</p>
  
  <p>Thanks!</p>