Tests for React components
just4fun opened this issue · comments
Jest has been introduced with create-react-app together, I also found Jest has some advantages than Mocha, such as Jest has snapshot testing, and the execution performance for tests is better than Mocha.
So I'd like to create this issue here to note my investigation result, maybe some article links.
First of all, I'd like to use Jest with Enzyme together, which is always used to test React components.
The next step is to investigate how to use the three different kinds of render approaches in Enzyme.
- shallow()
- mount()
- render()
https://www.codementor.io/vijayst/unit-testing-react-components-jest-or-enzyme-du1087lh8
Best article I found which show you how to use Jest and Enzyme together to test React components instead of comparing the two.
See here for new created tests: https://github.com/IFS49F/poker/compare/unit-testing
API differences between render and mount/shallow.