title: How do I test axios in Jest?
body: <p>I have this action in React:</p>
  <pre><code>export function fetchPosts() {
      const request = axios.get(`${WORDPRESS_URL}`);
      return {
          type: FETCH_POSTS,
          payload: request
      }
  }
  </code></pre>
  <p>How do I test <a href="https://github.com/mzabriskie/axios" rel="noreferrer">Axios</a> in this case?</p>
  <p>Jest has this use case on their site for asynchronous  code where they use a mock function, but can I do this with Axios?</p>
  <p>Reference: <em><a href="https://jestjs.io/docs/en/tutorial-async" rel="noreferrer">An Async Example</a></em></p>
  <p>I have done this so far to test that it is returning the correct type:</p>
  <pre><code>it('should dispatch actions with the correct type', () =&gt; {
      store.dispatch(fetchPosts());
      let action = store.getActions();
      expect(action[0].type).toBe(FETCH_POSTS);
  });
  </code></pre>
  <p>How can I pass in mock data and test that it returns?</p>