React TDD 테스트 케이스 별 구현 방법
주로 사용하는 케이스만 작성하였습니다. 테스트 대상 조회 getByTestId : data-testid로 조회 ... // test.ts screen.getByTestId('title') 2. geByText : text로 조회 제목 ... // test.ts screen.getByText('제목') 3. geByRole : role로 조회 제목 ... // test.ts screen.getByRole('제목') 4. getAllByText, getAllByTestId, getAllByRole... : 해당 요소들을 전부 조회 - 결과값은 배열입니다. 제목 두번째 제목 세번째 제목 ... // test.ts screen.getAllByTestId('제목') 데스트 케이스 구현 1. toBeInTheDoc..
React/TDD
2023. 2. 18. 11:32