title: Jest manual mock for axios not able to override the POST method from one of the test suite
body: <p>In the JavaScript file, I am having the logic below</p>
  <pre><code>const {
         data: { token: token }
        } = await axios({
                   method: 'post',
                   url: `XXX/xxx`,
                   headers: {},
                  data: data
           });
  </code></pre>
  <p>I have created a manually mock file in the folder <code>__mocks__</code> folder as axios.js and has below</p>
  <pre><code>jest.mock('axios');
  
  module.exports = config =&gt; {
      const url = config.url;
      if (config.method === 'post') {
          if (
              url.includes('XXX')
          ) {
              return Promise.resolve({
                  data: data
              });
          } else {
              return Promise.reject(new Error(`Invalid URL`));
          }
      } else if (config.method === 'get') {
          if (url.includes('YYY')) {
              return Promise.resolve({
                  data: data
              });
          } else {
              return Promise.reject(new Error(`Invalid URL`));
          }
      }
  };
  </code></pre>
  <p>From the actual token.test.js, i have imported the axios</p>
  <p>let axios = require('axios');</p>
  <p>In one of the test suites, I am not able to override the axios. For example, I want to override the POST call of URL to reject with &quot;Network Error&quot;. But I am not able to achieve it. Can anyone please help me on this?</p>