reduxjs / redux-mock-store

A mock store for testing Redux async action creators and middleware.
MIT License
2.5k stars 148 forks source link

getActionsByType ? #142

Closed stubar closed 4 years ago

stubar commented 6 years ago

I find in most test cases that I am doing a filter on getActions to make test a bit more specific. It would be handy to have a getActionsByType helper in the api so we could do a test like

expect(store.getActionsByType('modal/TOGGLE_MODAL_DIALOG')).toHaveLength(1)

Happy to raise a PR

acostalima commented 6 years ago

You can easily look-up an action by type with .find() and then assert the result.

dmitry-zaets commented 4 years ago

Agree with @acostalima Also, you can take a look into https://redux-things.github.io/redux-actions-assertions