I use Redux powered by "easy peasy". I am trying to test existing React Store. Particularly I need to test the thunk
part of store with thunk that I need to test
...
clients: [],
...
loadClients: thunk(async (actions) => {
try {
const result = await get(`${baseUrl}/api/clients`);
actions.parseClientsResponse(result);
} catch (error) {
console.log(error);
actions.displayErrorMessage(error);
}
}),
parseClientsResponse: action((storeState, clients) => {
storeState.clients = clients;
}),
Please help me with any ideas how to test it. Assume that the thunk does not take any parameters
Eventually, since fetch executes my api call behind the scene, I have solved it using fetchMock
Thank you @timotgl for help