Replies: 1 comment
-
Honestly, it's just not really a use case we had in mind as we just use the "real" store for testing (at least I know I am). If you need the actions that were dispatched, just add an additional reducer in your test environment like function actionsReducer(state = [], action) { return [...state, action] } and you are rid of an additional dependency. Also, most React tests nowadays are more integration-like, so many people don't even test reducers in isolations at all. We'll probably add a few more testing-related things in a future update of RTK. Ideas are very welcome :) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
So redux-toolkit imports and re-exports ThunkAction and ThunkDispatch types from redux-thunk, and it also adds redux-thunk as a default middleware when configuring redux store. Why doesn't it re-export the thunk middleware itself? It might help ever so slightly when setting up a mock redux store for testing purposes: as of now the user would also need to install redux-thunk separately to set up the mock store as described in the redux docs:
Beta Was this translation helpful? Give feedback.
All reactions