Hacker News new | ask | show | jobs
by eropple 3029 days ago
How do you test the code being run inside the Redux store? How do you mock your API client?
1 comments

A thunk action `fetchData` would return a `(dispatch, getState) => {}` function. You call that with `getState` that would return your fixtures, and verify that `dispatch` gets called as expected. For API, I use jest and mock out imported functions.