How do we test asynchronous actions? The ones that depends on a API call that may or may not be resolved. This is what we are going to focus here: how to make sure your actions are called in order and how to intercept axios to not make actual API calls.

TL;DR: the complete code is in the end of the article!

Just to be clear this is what we are going to be using:

  • Moxios to mock API calls made by Axios
  • redux-mock-store to mock our store
  • Enzyme for testing utilities
  • Redux Thunk for…

Adriel Tosi

Front End developer and UI designer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store