로직은 동일하고 값만 변하는 테스트를 여러 번 할 때, Jest.each() 를 활용하면 테스트를 보다 간소화 할 수 있다.
Jest.each() 는 Jest 23부터 기본 패키지로 포함되어 있다. 이전 버전은 Jest-each 패키지 설치가 필요하다
'Front-End > Testing' 카테고리의 다른 글
axios-mock-adapter api (0) | 2024.02.15 |
---|---|
React Testing Library - 렌더링 검증 (0) | 2024.02.14 |
AAA 패턴(Arrange, Act, Assert) (0) | 2024.02.14 |
React Testing Pattern - 설정(setup)과 해지(teardown) (0) | 2024.02.13 |
React Testing Library - afterAll, beforeAll, afterEach, beforeEach (0) | 2024.02.12 |
댓글