3 ms·
How do you test the code being run inside the Redux store? How do you mock your API client?
by eropple 9y ago
How do you test the code being run inside the Redux store? How do you mock your API client?
- silversmith 9y agoA 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.