description: "테스트 작성 가이드라인" paths:
재사용 가능한 컴포넌트는 격리하여 단위 테스트한다.
페이지 레벨은 사용자 시나리오 기반 통합 테스트를 우선한다.
사용자가 실제로 상호작용하는 방식과 가깝게 요소를 찾는다.
// ✅ 권장 순서
screen.getByRole("button", { name: "저장" }); // 1. role
screen.getByLabelText(/이메일/); // 2. label
screen.getByPlaceholderText("검색..."); // 3. placeholder
screen.getByText("저장되었습니다."); // 4. text
// ❌ 최후의 수단
screen.getByTestId("save-button"); // data-testid는 가능한 피함
테스트 파일은 테스트 대상과 같은 디렉토리에 위치한다.
button.tsx
button.test.tsx ← 같은 폴더
공통 헬퍼 함수는 src/test/ 또는 src/shared/test/에 모아둔다.
createTestQueryClient() — 테스트용 QueryClientrenderWithProviders() — Provider 래핑 헬퍼아직 피드백이 없어요. 첫 번째로 의견을 남겨보세요!