Exhaustive testing can cause a lot of 'duplicated' testing #479
sareninden
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
Thanks for the idea! As heavy users of TCA, we've encountered our fair share of test verboseness 😅 In general we think that exhaustivity is a good thing, and that tests that are verbose with a lot of duplicated testing could indicate a complex reducer that could be broken down into smaller reducers that are easier to test. That said, I could still see the library leveraging something like store.skipCompletion() That way these tests are still called out in some way. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am working for a while now with TCA and I noticed that when one action leads to another, and to another and so on might cause a lot of duplication since any path might diverge into any other path. Of course you stub everything to direct it into a certain flow but still I end up with over ten receive actions on my teststore from time to time.
For this we could introduce an option like
terminate
on the TestStore.This is not ideal since new actions might be inserted before this terminate. For this we could do something like
This would ensure that we terminate with the expected receive command.
The main advantage of this is to reduce test duplication.
For example I now test pressing the send button
actions
This is even a simplified chain of what I am having. But it also duplicates for example another test where I validate the sendForm (or I would only write a single test that handles the failing and 'assume' that it is clear that another 'unrelated' test test the other scenario).
Alternative
It is also possible to have the environment return an
Effect.none
for some cases. This will also stop the chain. In my opinion this is less clear in its intend and does not improve test readability/intention.Beta Was this translation helpful? Give feedback.
All reactions