title: Unable to mock axios call in Jest
body: <p>It seems mocking is not working for me via axios as it seems to make acrtual API calls ( visible because I am getting 401 status code when running jest test ) I am not sure why am I not able to mock axios.Can anyone point out the mistake I am making?</p>
  <p>index.test.ts</p>
  <pre><code>describe(&quot;compositeScore()&quot;, () =&gt; {
  
      it(&quot;Mock Fetch API for Composite Score Response&quot;, async () =&gt; {
          
          const mock = jest.spyOn(axios, &quot;post&quot;);
          mock.mockReturnValueOnce(mockResponse);
          const response = await dateFilter(platform);
          expect(mock).toHaveBeenCalledTimes(1);
          expect(response).toEqual(mockFetchCompositeScoreResponse);
      });
  });
  </code></pre>
  <p>index.ts</p>
  <pre><code>export const dateFilters = async (platform) =&gt; {
      const dates = await fetchWrapper(
          platform.toLowerCase().concat(&quot;DateFilters&quot;),
          platform,
          {}
      );
      return dates;
  };
  
  
  export async function fetchWrapper(
      queryName: string,
      platform: string,
      queryParams?: {}
  ) {
     
      const headers = {
          Accept: &quot;application/json&quot;,
          Authorization: `Bearer ${token}`,
          &quot;Content-Type&quot;: &quot;application/json&quot;,
       
      };
      const config: AxiosRequestConfig = {
          method: &quot;post&quot;,
          url,
          headers,
          data: {
              db: dbName,
              csl: queryParams
                  ? substituteQueryParameters(queries[queryName], queryParams)
                  : queries[queryName],
          },
      };
  
      return axios(config);
  }
  </code></pre>