How to Unit Test a Form Component with React Testing Library and Jest โ Next.js 13 App Router, Complete, Step-by-step
Create mini robots to make sure components meet expectations.
Complete Step-by-step Tutorial
Series:
Stack:
Preview
Drawing of the Form component annotated with my expectations. |
A screenshot showing all expectations passed. |
Before you begin, ensure you have the following software installed:
- GitHub CLI
- Node.js 16.8 or later.
- macOS, Windows (including WSL), and Linux are supported.
- Prettier VS Code Extension
- Create your GitHub repo using this project as template.
gh repo create <repo-name> --public --template=saikise/simple-unit-test-ctwnj
- Install the dependencies listed in
package.json
.
npm i
- Play with the app via development server.
npm run dev
- Run the test script via Terminal
npm run test:ci