I am writing a react-redux
app and in one of my action creators I am making an api request via axios
Roughly, it looks something like this:
import axios from 'axios'
export function getStoredData(userInput) {
.
.
.
var url = generateURL(userInput);
var response = axios.get(url);
return {
type: GET_STORED_DATA
payload: repsonse;
};
}
I wanted to mock axios using axios-mock-adapter but I don't quite understand how to do that, especially since I wouldn't want to modify my action creator
for the test.
Please suggest any resources/guide to doing this...
the submitRegistrationStepOneForm action:
You can use dependency injection to swap the http client, eg.