React Todo Application TDD Workflow
npx create-react-app my-app
cd my-app
npm start
- props: immutable, all React components must act like pure functions with respect to their props
- state: is private and fully controlled by the component
- unidirectional or top-down data flow
The test should drive the development.
-
- validate the functionality of isolated code
-
- verify the flow of data and the interaction of components
-
- look at the behavior of the overall application.
Enzyme is a JavaScript Testing utility for React that makes it easier to test your React Components' output.
-
- Real unit test (isolation, no children render)
-
- Full rendering including child components. Requires a DOM (jsdom, domino). More constly in execution time.
-
- toMatchSnapshot()