Replies: 1 comment 3 replies
-
I've blogged and open sourced a non-exhaustive version of TestStore I've build for my team |
Beta Was this translation helpful? Give feedback.
3 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.
Uh oh!
There was an error while loading. Please reload this page.
-
Dear TCA community,
In our production code, we've been finding the
TestStore
essential, however there are often cases where we'd like to ignore intermediate actions & state changes, and simply test that invoking an action produces a desired end-state. This starts to manifest in larger & more complex reducers, whereby we may write a number of tests for a single action, and must replicate the intermediate state changes in each test.In short, is it (or will it ever be) possible with the current
TestStore
to invoke an action, and only test the end-state?For example, something like this would be great:
Rather than:
Whilst I can see the many benefits of always testing the action & state changes in the latter example, I think there can also be benefits to just verifying the end-state. Perhaps it could be argued this issue signifies our reducer design could be improved (e.g. by breaking them into smaller & more testable components), but refactoring reducers in production code may not always be viable (due to business requirements / timescales etc). So in this sense, having the option to write some simpler / more readable tests would be preferable over maintaining complex and replicated test-code.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions