jest is a testing framework for react. In this example we show how to use jest to do DOM-testing for react applications in next
npm install --save-dev jest babel-jest enzyme
jest- The testing frameworkbabel-jest- Babel preprocessor for test filesenzyme- Mock render the elements
Add test script to the recommended package.json
package.json
...
"scripts": {
"test": "jest",
...
}
...npm run test