title: Why am I unable to use mockResolvedValue here?
body: <p>I’m unclear on how to mock my api response when using the following setup.</p>
  <p>I have the following test:</p>
  <pre class="lang-js prettyprint-override"><code>import React from 'react';
  import { cleanup, render, wait } from '@testing-library/react';
  import axios from 'axios';
  import Condition from './index.jsx';
  
  jest.mock('axios', () =&gt; {
    return {
      create: jest.fn(() =&gt; ({
        get: jest.fn().mockResolvedValue({ data: {} }),
        interceptors: {
          request: { use: jest.fn(), eject: jest.fn() },
          response: { use: jest.fn(), eject: jest.fn() },
        },
      })),
    };
  });
  
  
  afterEach(cleanup);
  
  test('fetches and displays data', async () =&gt; {
    axios.get.mockResolvedValue({ data: 'mock data' });
    const { container } = render(&lt;Condition {...props} /&gt;);
    await wait(() =&gt; expect(container.textContent).toContain('Current milestone'));
    expect(container).toBeDefined();
  });
  </code></pre>
  <p>… and the following api helper:</p>
  <pre class="lang-js prettyprint-override"><code>import axios from 'axios';
  
  const api = axios.create({
    baseURL: window.apiPath,
    withCredentials: true,
  });
  
  api.interceptors.request.use(config =&gt; {
    const newConfig = Object.assign({}, config);
    newConfig.headers.Accept = 'application/json';
  
    return newConfig;
  }, error =&gt; Promise.reject(error));
  
  export default api;
  </code></pre>
  <p>My <code>Condition</code> component uses the following function to fetch data when it mounts:</p>
  <pre class="lang-js prettyprint-override"><code>const fetchAsync = async endpoint =&gt; {
    const result = await api.get(endpoint);
    setSuffixOptions(result.data.data);
    console.log('result.data.data', result.data.data);
  };
  </code></pre>
  <p>The <code>axios.get.mockResolvedValue({ data: 'mock data' });</code> line in the test causes the following error:</p>
  <pre class="lang-sh prettyprint-override"><code>    TypeError: Cannot read property 'mockResolvedValue' of undefined
  
        124 |
        125 | test('fetches and displays data', async () =&gt; {
      &gt; 126 |   axios.get.mockResolvedValue({ data: 'mock data' });
            |             ^
        127 |   const { container } = render(&lt;Condition {...props} /&gt;);
        128 |   await wait(() =&gt; expect(container.textContent).toContain('Current milestone'));
        129 |   expect(container).toBeDefined();
  </code></pre>
  <p>Should I be using a different method for mocking the response?</p>
  <p><strong>EDIT</strong>
  Calling <code>axios.create.get.mockResolvedValue({ data: 'mock data' });</code> results in the same error.</p>