Closed kuhnroyal closed 4 years ago
I found a way by overriding dispatch*
functions of the Store implementation and checking against an ignore list before calling super
.
Is this the recommended way?
I never really had this problem of ignoring some actions. I guess you found a nice solution.
@kuhnroyal
Just added your idea to AsyncRedux [version 2.12.0], and expanded it so that you can mock actions/reducers, not only disable them. Please have a look:
https://pub.dev/packages/async_redux#mocking-actions-and-reducers
Thanks @marcglasberg, this is perfect!
I often have actions that dispatch new actions in
after*
functions, basically chaining a few actions. When unit testing I always have to mock everything for the whole action chain when I only want to test the first action. Is there a way to prevent the actual dispatch of these chained action in tests? StoreTester allows to ignore actions but that is only in regard to their validation.