You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Testing a thunk that calls an action is very simple, using the mockActions helper, however, this becomes very difficult when testing that a thunk calls another thunk.
It is common practice for large stores to dispatch other thunks when something happens inside your thunk. This is possible using getStoreActions. When testing this behavior since mockActions doesn't prevent the call to the other thunk I'm having to include other store models to satisfy my test. This feels bad every time I run into it, like the boundaries of my test are not well defined. for example:
As more models depend on each other this becomes increasingly difficult to maintain. Not sure if there is a workaround for this in place or if there is a plan to support this in the future. I'd be happy to contribute something like this if I get some high-level direction on how to accomplish it.
The text was updated successfully, but these errors were encountered:
Testing a thunk that calls an action is very simple, using the
mockActions
helper, however, this becomes very difficult when testing that a thunk calls another thunk.It is common practice for large stores to
dispatch
other thunks when something happens inside your thunk. This is possible usinggetStoreActions
. When testing this behavior sincemockActions
doesn't prevent the call to the other thunk I'm having to include other store models to satisfy my test. This feels bad every time I run into it, like the boundaries of my test are not well defined. for example:I would expect the above to pass but it fails because the model actually calls the thunk. You end up having to do something like this:
As more models depend on each other this becomes increasingly difficult to maintain. Not sure if there is a workaround for this in place or if there is a plan to support this in the future. I'd be happy to contribute something like this if I get some high-level direction on how to accomplish it.
The text was updated successfully, but these errors were encountered: