title: How to mock response error with axios-mock-adapter and jest
body: <p>I have set up axios-mock-adapter in order to facilitate unit tests for my axios requests and all works quite well when mocking successful responses, however I am unable to make a solid test to cover failures. I have an axios instance and I have this unit test to check for failures</p>
  <pre><code> it('should throw error', async () =&gt; {
    mock.onGet(my_url).reply(401);
  
    const expectedError = async () =&gt; {
      await myFailingFunction();
    };
  
    return expect(expectedError()).rejects.toThrowError();
  });
  });
  </code></pre>
  <p>and that recognises that the request fails, which is fine but I'd like to be able to check the status code and make sure that the response returns exactly 401 status code along with error message, so that I can validate all failing cases (400, 401, 500, etc)</p>