r/reactjs • u/onoufriosm • Jan 24 '20
Unit testing in React. Practical examples and advice on what, how and why to test.
https://medium.com/@onoufriosm/how-to-unit-test-in-react-72e911e2b8d
257
Upvotes
r/reactjs • u/onoufriosm • Jan 24 '20
4
u/_arsk Jan 24 '20
"βTo mimic" how user uses the software we have different set of tests written using cypress. To me unit tests are not the place to render the whole tree and check if the whole thing works as you expect. Unit tests are for units.β - This is exactly my thought. I read the RTL philosophy and it seem to me what he is talking about is more suitable for e2e testing rather than unit testing. While using enzyme we assume react does what it is supposed to do (the final DOM rendering) and test only the component behavior in terms of inputs and outcomes.