title: Jest Mock returns undefined instead of data
body: <p>I'm trying to mock a function and not sure what i'm doing wrong here. I have this function "getGroups"</p>
  
  <p>getGroups:</p>
  
  <pre><code>export const getGroups = async () =&gt; {
    try {
      const groupApiUrl = getDashboardPath(GROUPS_TAB_INDEX);
      const data = await fetch(groupApiUrl, { cache: 'force-cache' });
      const userData = await data.json();
      return userData;
    } catch (error) {
      throw Error(error);
    }
  };
  </code></pre>
  
  <p>___mocks___/getGroups.js:</p>
  
  <pre><code>export default async () =&gt; {
    return {
      groups: [
        { id: 1, name: 'Data1' },
        { id: 2, name: 'Data2' }
      ]
    };
  };
  </code></pre>
  
  <p>getGroups.test.js: </p>
  
  <pre><code>jest.mock('./getGroups.js');
  // eslint-disable-next-line import/first
  import { getGroups } from './getGroups';
  
  const fakeRespose = {
    groups: [
      { id: 1, name: 'Data1' },
      { id: 2, name: 'Data2' }
    ]
  };
  
  describe('getGroups', () =&gt; {
    it('returns data', async () =&gt; {
      const data = await getGroups();
      console.log('DATA', data);  &lt;---- UNDEFINED?
      expect(data).toBeDefined();
      expect(data).toMatchObject(fakeRespose);
    });
  
    it('handles error', async () =&gt; {
      // const data = await getGroups();
      await getGroups().toThrow('Failed');
    });
  });
  </code></pre>