Test(#141): 최근 기능 변경에 따른 회귀 테스트 복구 - #142
Conversation
📝 WalkthroughWalkthroughHomePage 테스트에 QueryClientProvider를 적용했습니다. StudyPage와 ReviewPage 테스트는 숫자형 스터디 ID와 상세 API 응답을 사용하도록 갱신했습니다. 라우트, 모달, 비동기 렌더링 검증도 변경했습니다. Changes회귀 테스트 복구
Estimated code review effort: 2 (Simple) | ~10 minutes Mergeability Score: 🔵 Low · up to The PR restores regression coverage, but unknown numeric study IDs are not yet verified against the intended 404 behavior, so related tests could provide incomplete protection against regressions. The PR is otherwise mergeable with explicit owner follow-up on this bounded test gap. Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/pages/home/HomePage.test.tsx`:
- Around line 34-47: Change the test utility renderHome from an arrow function
to a function declaration, using function renderHome() while preserving its
existing QueryClientProvider return structure.
In `@src/pages/study/StudyPage.test.tsx`:
- Around line 122-145: Update src/pages/study/StudyPage.test.tsx:122-145 so
createStudyDetailResponse does not return success for unknown numeric IDs, and
mock the 999 study request as an explicit 404. In
src/pages/study/StudyPage.test.tsx:190-194, verify the 404 behavior matches
StudyPage.tsx by asserting navigation to the home page. In
src/pages/review/ReviewPage.test.tsx:323-327, add an explicit 404 mock for
/api/study/999.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 5d425459-2e22-48ca-a8a8-c6ce875f628e
📒 Files selected for processing (3)
src/pages/home/HomePage.test.tsxsrc/pages/review/ReviewPage.test.tsxsrc/pages/study/StudyPage.test.tsx
| const renderHome = () => { | ||
| const queryClient = new QueryClient({ | ||
| defaultOptions: { queries: { retry: false } }, | ||
| }); | ||
|
|
||
| return render( | ||
| <QueryClientProvider client={queryClient}> | ||
| <MemoryRouter> | ||
| <HomePage /> | ||
| <LocationProbe /> | ||
| </MemoryRouter> | ||
| </QueryClientProvider>, | ||
| ); | ||
| }; |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
renderHome을 function 선언으로 변경하세요.
renderHome은 컴포넌트가 아닌 테스트 유틸리티입니다. 현재 화살표 함수로 선언되어 일반 함수 규칙을 위반합니다. function renderHome()으로 변경하고 QueryClientProvider 반환 구조는 유지하세요.
As per coding guidelines, "일반 함수는 function 선언을 사용하며, 컴포넌트는 화살표 함수를 사용합니다."
수정 예시
-const renderHome = () => {
+function renderHome() {
const queryClient = new QueryClient({
defaultOptions: { queries: { retry: false } },
});
return render(
<QueryClientProvider client={queryClient}>
<MemoryRouter>
<HomePage />
<LocationProbe />
</MemoryRouter>
</QueryClientProvider>,
);
-};
+}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const renderHome = () => { | |
| const queryClient = new QueryClient({ | |
| defaultOptions: { queries: { retry: false } }, | |
| }); | |
| return render( | |
| <QueryClientProvider client={queryClient}> | |
| <MemoryRouter> | |
| <HomePage /> | |
| <LocationProbe /> | |
| </MemoryRouter> | |
| </QueryClientProvider>, | |
| ); | |
| }; | |
| function renderHome() { | |
| const queryClient = new QueryClient({ | |
| defaultOptions: { queries: { retry: false } }, | |
| }); | |
| return render( | |
| <QueryClientProvider client={queryClient}> | |
| <MemoryRouter> | |
| <HomePage /> | |
| <LocationProbe /> | |
| </MemoryRouter> | |
| </QueryClientProvider>, | |
| ); | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/pages/home/HomePage.test.tsx` around lines 34 - 47, Change the test
utility renderHome from an arrow function to a function declaration, using
function renderHome() while preserving its existing QueryClientProvider return
structure.
Source: Coding guidelines
| function createStudyDetailResponse(path: string) { | ||
| const routeStudyId = path.split('/')[2]; | ||
| const studyId = Number(routeStudyId); | ||
| const isEnded = studyId === 2; | ||
|
|
||
| return { | ||
| data: { | ||
| code: 'STUDY200_1', | ||
| errorDetail: null, | ||
| message: '스터디 정보를 조회했습니다.', | ||
| result: { | ||
| currentWeek: 3, | ||
| description: '테스트 스터디입니다.', | ||
| isActive: !isEnded, | ||
| isLeader: true, | ||
| members: ['김스토', '이영희'], | ||
| name: isEnded ? '종료된 스터디' : '백엔드 마스터', | ||
| reviewerCount: 2, | ||
| startDate: '2026-03-01', | ||
| studyId, | ||
| }, | ||
| success: true, | ||
| }, | ||
| }; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
알 수 없는 숫자형 스터디 ID 테스트가 상세 API 오류 계약을 직접 표현하지 않습니다.
src/pages/study/StudyPage.test.tsx#L122-L145:createStudyDetailResponse가 알 수 없는 숫자 ID에 성공 응답을 반환하지 않도록 수정하고,999요청을 404로 모킹하세요.src/pages/study/StudyPage.test.tsx#L190-L194: 제공된StudyPage.tsx계약에 맞게 404 후 홈 이동을 검증하세요.src/pages/review/ReviewPage.test.tsx#L323-L327:/api/study/999에 명시적인 404 응답을 모킹하세요.
📍 Affects 2 files
src/pages/study/StudyPage.test.tsx#L122-L145(this comment)src/pages/study/StudyPage.test.tsx#L190-L194src/pages/review/ReviewPage.test.tsx#L323-L327
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/pages/study/StudyPage.test.tsx` around lines 122 - 145, Update
src/pages/study/StudyPage.test.tsx:122-145 so createStudyDetailResponse does not
return success for unknown numeric IDs, and mock the 999 study request as an
explicit 404. In src/pages/study/StudyPage.test.tsx:190-194, verify the 404
behavior matches StudyPage.tsx by asserting navigation to the home page. In
src/pages/review/ReviewPage.test.tsx:323-327, add an explicit 404 mock for
/api/study/999.
📌 관련 이슈
🏷️ PR 타입
📝 작업 내용
코드 리뷰 반영
renderHome테스트 유틸리티를 function 선언으로 변경📸 스크린샷
✅ 체크리스트
dev브랜치를 현재 작업 브랜치에 반영했습니다.🔀 Merge 규칙
dev로 병합할 때는 Squash and merge를 사용합니다.dev에서main으로 병합할 때는 Create a merge commit을 사용합니다.dev반영을 확인한 후 Merge합니다.📎 기타 참고사항
Summary by CodeRabbit