I need some opinions about testing redux. Generally speaking reducers, selectors, actions creators are pure functions therefore it is supper easy to write isolated unit tests. But in the reality such isolated tests cause some many problems, like:
1/ a relatively small change could break a lot of tests,
2/ or the opposite - a change in reducer shape might not be recognized in isolated test case for selectors,
3/ we could end up with bloated and duplicated tests, etc.
Therefore in my current project I'm experimenting with more integration like approach: https://gist.github.com/lucassus/730139425cdbdeb94f7eb27488ab0f7c#file-test-ts (these examples are based on https://github.com/reduxjs/redux-toolkit library)
What do you think about such tests?
Aucun commentaire:
Enregistrer un commentaire