Skip to content

Test(#141): 최근 기능 변경에 따른 회귀 테스트 복구 - #142

Merged
BigSangHyeok merged 2 commits into
devfrom
test/141-restore-regression-tests
Aug 13, 2026
Merged

Test(#141): 최근 기능 변경에 따른 회귀 테스트 복구#142
BigSangHyeok merged 2 commits into
devfrom
test/141-restore-regression-tests

Conversation

@BigSangHyeok

@BigSangHyeok BigSangHyeok commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

📌 관련 이슈

🏷️ PR 타입

  • ✨ 기능 추가 (Feature)
  • 🐛 버그 수정 (Bug Fix)
  • ♻️ 리팩토링 (Refactoring)
  • 🎨 스타일 변경 (Style)
  • ✅ 테스트 추가 (Test)
  • ⚙️ 프로젝트 초기 설정 (Chore)
  • 📝 문서 수정 (Documentation)
  • 🚨 PR 복구 (Revert)

📝 작업 내용

  • HomePage 테스트에 QueryClientProvider를 적용했습니다.
  • 스터디 상세 API 공통 응답과 숫자형 라우트 테스트를 반영했습니다.
  • 종료 스터디의 검토 화면을 읽기 전용 상태로 검증했습니다.
  • 전체 테스트 176개 통과를 확인했습니다.

코드 리뷰 반영

  • renderHome 테스트 유틸리티를 function 선언으로 변경
  • 존재하지 않는 숫자형 스터디의 상세 API 404 응답 모킹
  • StudyPage의 404 발생 후 홈 이동 검증
  • ReviewPage의 스터디 상세 API 404 오류 상태 검증

📸 스크린샷

✅ 체크리스트

  • 코드 리뷰를 받을 준비가 완료되었습니다.
  • 코드 스타일 가이드를 준수했습니다.
  • 셀프 리뷰를 완료했습니다.
  • 테스트를 작성하고 모두 통과했습니다.
  • 문서를 업데이트했습니다. (필요한 경우)
  • CI의 format, lint, build 검사를 모두 통과했습니다.
  • 최신 dev 브랜치를 현재 작업 브랜치에 반영했습니다.

🔀 Merge 규칙

  • 기능 브랜치에서 dev로 병합할 때는 Squash and merge를 사용합니다.
  • 배포 시 dev에서 main으로 병합할 때는 Create a merge commit을 사용합니다.
  • Rebase and merge는 사용하지 않습니다.
  • CI 통과와 최신 dev 반영을 확인한 후 Merge합니다.

📎 기타 참고사항

  • jsdom에서는 WebGL Canvas를 지원하지 않아 3D 그래프 관련 경고가 출력되지만 테스트 실패에는 영향을 주지 않습니다.

Summary by CodeRabbit

  • 테스트
    • 홈 화면의 할 일 상세보기 및 모달 동작 검증을 강화했습니다.
    • 리뷰 화면에서 활성·종료·존재하지 않는 스터디와 투표 실패 상황의 검증을 보완했습니다.
    • 스터디 상세, 리포트, 기록, 질문 화면의 숫자형 식별자와 비동기 로딩 동작에 대한 테스트를 추가·개선했습니다.
    • 잘못된 탭과 경로에 대한 화면 동작 검증을 강화했습니다.

@BigSangHyeok BigSangHyeok self-assigned this Aug 13, 2026
Copilot AI lite review requested due to automatic review settings August 13, 2026 02:41
@BigSangHyeok BigSangHyeok added the test 테스트 코드 작성 label Aug 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

HomePage 테스트에 QueryClientProvider를 적용했습니다. StudyPage와 ReviewPage 테스트는 숫자형 스터디 ID와 상세 API 응답을 사용하도록 갱신했습니다. 라우트, 모달, 비동기 렌더링 검증도 변경했습니다.

Changes

회귀 테스트 복구

Layer / File(s) Summary
HomePage Query Client 테스트 설정
src/pages/home/HomePage.test.tsx
테스트 렌더링에 재시도 비활성화 QueryClientQueryClientProvider를 추가했습니다. 내 할 일 항목은 상세 모달 표시와 루트 경로를 검증합니다.
StudyPage 숫자형 라우트 및 상세 API 모킹
src/pages/study/StudyPage.test.tsx
숫자형 스터디 ID별 상세 응답과 라우트 렌더링 헬퍼를 추가했습니다. 탭, 업로드, 리포트, 기록, 질문 경로와 비동기 결과 검증을 갱신했습니다.
ReviewPage 숫자형 스터디 API 테스트 데이터
src/pages/review/ReviewPage.test.tsx
활성 및 종료 스터디의 상세 API 응답을 추가했습니다. 리뷰와 투표 실패, 존재하지 않는 스터디 테스트의 경로를 숫자형 ID로 변경했습니다.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: 🔵 Low · up to baf7b

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

  • Stology/FE#112: React Query 기반 HomePage 훅에 맞춘 QueryClientProvider 테스트 설정과 직접 관련됩니다.
  • Stology/FE#116: StudyPage.test.tsx의 리포트 API 모킹과 숫자형 스터디 ID 변경이 겹칩니다.
  • Stology/FE#129: StudyPage API 통합에 맞춘 숫자형 ID 및 React Query 테스트 변경과 관련됩니다.

Suggested reviewers: mint0326

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed HomePage, StudyPage, ReviewPage 테스트 변경과 전체 테스트 통과가 이슈 #141의 모든 주요 목표에 부합합니다.
Out of Scope Changes check ✅ Passed 변경 사항은 테스트 코드와 테스트 모킹에 한정되며 이슈 #141의 범위를 벗어난 변경이 없습니다.
Description check ✅ Passed 이슈, PR 유형, 작업 내용, 테스트 결과, 체크리스트, 참고사항을 포함해 설명이 대부분 완전합니다.
Title check ✅ Passed 제목이 최근 기능 변경으로 실패한 회귀 테스트를 복구하는 주요 변경 내용을 명확하게 설명합니다.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 985a0ed and baf7bbb.

📒 Files selected for processing (3)
  • src/pages/home/HomePage.test.tsx
  • src/pages/review/ReviewPage.test.tsx
  • src/pages/study/StudyPage.test.tsx

Comment thread src/pages/home/HomePage.test.tsx Outdated
Comment on lines +34 to +47
const renderHome = () => {
const queryClient = new QueryClient({
defaultOptions: { queries: { retry: false } },
});

return render(
<QueryClientProvider client={queryClient}>
<MemoryRouter>
<HomePage />
<LocationProbe />
</MemoryRouter>
</QueryClientProvider>,
);
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

renderHomefunction 선언으로 변경하세요.

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.

Suggested change
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

Comment on lines +122 to +145
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,
},
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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-L194
  • src/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.

@wonjun6768-dev wonjun6768-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인했습니다

@BigSangHyeok
BigSangHyeok merged commit e955a53 into dev Aug 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test 테스트 코드 작성

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Test] 최근 기능 변경에 따른 회귀 테스트 복구

3 participants