Setting up and Testing with Jest and React Testing Library
ฝัง
- เผยแพร่เมื่อ 22 ก.ย. 2024
- In this tutorial, we setup Jest and React Testing Library (including userEvent!), and write two tests that cover most of the concepts you need to know.
0:50 - Installing dependencies
02:00 - Jest configuration
03:00 - Component to be tested overview
04:00 - How to organize your tests
05:00 - Writing your first test
09:30 - Setting up userEvent library
16:00 - Writing tests with userEvent
Code:
package.json: gist.github.co...
test.utils.ts: gist.github.co...
jest.config.json: gist.github.co...
References:
jestjs.io/docs...
testing-librar...
diogoredin.com...