Enzyme is an open source JavaScript testing library that was created by Airbnb and works with almost every JavaScript library or framework. With Enzyme, you can also shallow render components to test the first level of the component, as well as render nested components, and simulate life cycles for integration tests. The Enzyme library can be installed with npm, and also needs an adapter to simulate React features. Let's get started:
- To install Enzyme, you need to run the following command from your Terminal, which installs Enzyme and the specific adapter for the version of React you're using:
npm install enzyme enzyme-adapter-react-16 --save-dev
- After installing Enzyme, you need to create a setup file that ...