title: Mock inner axios.create()
body: <p>I'm using <code>jest</code> and <code>axios-mock-adapter</code> to test <code>axios</code> API calls in <code>redux</code> async action creators. </p>
  
  <p>I can't make them work when I'm using a <code>axios</code> instance that was created with <code>axios.create()</code> as such:</p>
  
  <pre><code>import axios from 'axios';
  
  const { REACT_APP_BASE_URL } = process.env;
  
  export const ajax = axios.create({
    baseURL: REACT_APP_BASE_URL,
  });
  </code></pre>
  
  <p>which I would consume it in my <code>async action creator</code> like:</p>
  
  <pre><code>import { ajax } from '../../api/Ajax'
  
  export function reportGet(data) {
    return async (dispatch, getState) =&gt; {
      dispatch({ type: REQUEST_TRANSACTION_DATA })
  
      try {
        const result = await ajax.post(
           END_POINT_MERCHANT_TRANSACTIONS_GET,
           data,
        )
        dispatch({ type: RECEIVE_TRANSACTION_DATA, data: result.data })
        return result.data
      } catch (e) {
        throw new Error(e);
      }
    }
  }
  </code></pre>
  
  <p>Here is my test file:</p>
  
  <pre><code>import {
    reportGet,
    REQUEST_TRANSACTION_DATA,
    RECEIVE_TRANSACTION_DATA,
  } from '../redux/TransactionRedux'
  import configureMockStore from 'redux-mock-store'
  import thunk from 'redux-thunk'
  import { END_POINT_MERCHANT_TRANSACTIONS_GET } from 'src/utils/apiHandler'
  import axios from 'axios'
  import MockAdapter from 'axios-mock-adapter'
  
  const middlewares = [thunk]
  const mockStore = configureMockStore(middlewares)
  const store = mockStore({ transactions: {} })
  
  test('get report data', async () =&gt; {
    let mock = new MockAdapter(axios)
  
    const mockData = {
      totalSalesAmount: 0
    }
  
    mock.onPost(END_POINT_MERCHANT_TRANSACTIONS_GET).reply(200, mockData)
  
    const expectedActions = [
      { type: REQUEST_TRANSACTION_DATA },
      { type: RECEIVE_TRANSACTION_DATA, data: mockData },
    ]
  
    await store.dispatch(reportGet())
    expect(store.getActions()).toEqual(expectedActions)
  })
  </code></pre>
  
  <p>And I only get one action <code>Received: [{"type": "REQUEST_TRANSACTION_DATA"}]</code> because there was an error with the <code>ajax.post</code>. </p>
  
  <p>I have tried many ways to mock the <code>axios.create</code> to no avail without really knowing what I'm doing..Any Help is appreciated.</p>