Skip to content

[Feature] Promotion API 추가 및 테스트 인프라 구축#1136

Merged
seongwon030 merged 11 commits intodevelop-fefrom
feature/#1135-promotion-api-MOA-597
Feb 8, 2026
Merged

[Feature] Promotion API 추가 및 테스트 인프라 구축#1136
seongwon030 merged 11 commits intodevelop-fefrom
feature/#1135-promotion-api-MOA-597

Conversation

@seongwon030
Copy link
Member

@seongwon030 seongwon030 commented Feb 3, 2026

#️⃣연관된 이슈

ex) #1135

📝작업 내용

1. API 에러 처리 개선

  • 불필요한 withErrorHandling 래퍼 함수 제거
  • 모든 API 함수를 handleResponse 직접 사용하도록 리팩토링

withErrorHandling 함수는 api에서 발생한 에러를 받고 다시 thorw하는 역할이었습니다.

그리고 handleResponse 내부에서 에러를 던지고 있기에 withErrorHandling는 필요없다고 생각했습니다.

2. Promotion API 구현 (7ee0ec7, 17fdde7)

  • getPromotionArticles(): 홍보게시판 목록 조회
  • createPromotionArticle(): 홍보게시판 글 작성
  • useGetPromotionArticles: 목록 조회 훅 (1분 캐싱)
  • useCreatePromotionArticle: 글 작성 훅 (자동 캐시 무효화)

3. MSW 테스트 인프라 구축

src/mocks/
├── browser.ts              # MSW 브라우저 워커
└── handlers/
    ├── index.ts           # 핸들러 통합
    └── promotion.ts       # 홍보게시판 API 모킹
.storybook/
└── preview.ts             # MSW 통합 설정
  • 백엔드 없이 독립적 개발 가능
  • 다양한 시나리오 테스트 (성공, 에러, 로딩)
  • Storybook에서 실제 API 호출 흐름 재현

4. API 테스트 작성

  • promotion.test.ts: 6개 테스트 케이스를 작성
  • jest-fetch-mock 사용

api 테스트를 해야할까 했지만 오랜만에 새로 추가된 api이고 추후 변경사항이 있을 것을 고려하여 응답, 에러 테스트를 짰습니다.

중점적으로 리뷰받고 싶은 부분(선택)

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?

논의하고 싶은 부분(선택)

논의하고 싶은 부분이 있다면 작성해주세요.

🫡 참고사항

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능

    • 프로모션 아티클 관리 기능 추가 (조회, 생성)
  • 개선 사항

    • API 오류 처리 흐름 간소화
  • 테스트

    • 프로모션 API 단위 테스트 추가
  • 기타

    • 개발 및 Storybook 환경의 Mock Service Worker 설정 업데이트

- withErrorHandling 함수는 에러를 로깅하고 재throw하는 것 외에 없음
- 홍보리스트 get
- 홍보 게시물 post 구현
- 홍보게시판 API를 위한 React Query 훅을 추가
- Storybook에서 백엔드 없이 컴포넌트 개발을 위한 MSW 설정을 추가
@vercel
Copy link

vercel bot commented Feb 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
moadong Ready Ready Preview, Comment Feb 3, 2026 4:05pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2026

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Validation error: Invalid regex pattern for base branch. Received: "**" at "reviews.auto_review.base_branches[0]"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

개요

이 PR은 에러 처리 패턴을 중앙화된 래퍼에서 직접 처리로 변경하고, 홍보 API 기능을 새로 추가하며, MSW 모킹 인프라를 재구성합니다. 또한 MSW Storybook 통합을 추가합니다.

변경 사항

코호트 / 파일 요약
API 에러 처리 리팩토링
frontend/src/apis/applicants.ts, frontend/src/apis/application.ts, frontend/src/apis/auth.ts, frontend/src/apis/club.ts, frontend/src/apis/image.ts, frontend/src/apis/utils/apiHelpers.ts
모든 API 함수에서 withErrorHandling 래퍼 제거 후 직접 handleResponse 호출로 변경. 공개 API 서명은 유지되며 제어 흐름만 단순화됨.
홍보 API 추가
frontend/src/apis/promotion.ts, frontend/src/apis/promotion.test.ts, frontend/src/types/promotion.ts, frontend/src/hooks/Queries/usePromotion.ts, frontend/src/constants/queryKeys.ts
홍보 게시판 조회/생성 API 함수, React Query 훅, 타입 정의 및 테스트 추가. getPromotionArticles()createPromotionArticle() 내보냄.
MSW 핸들러 재구성
frontend/src/mocks/handlers/index.ts, frontend/src/mocks/handlers/promotion.ts, frontend/src/mocks/browser.ts
새로운 핸들러 인덱스 생성, 홍보 엔드포인트 모킹 추가, 핸들러 가져오기 경로 업데이트.
레거시 모킹 유틸리티 제거
frontend/src/mocks/api/apply.ts, frontend/src/mocks/api/applyHandlers.test.skip.ts, frontend/src/mocks/api/index.ts, frontend/src/mocks/api/utils/request.ts, frontend/src/mocks/constants/clubApi.ts, frontend/src/mocks/constants/error.ts, frontend/src/mocks/data/mockData.ts, frontend/src/mocks/utils/createApiUrl.ts, frontend/src/mocks/utils/createApiUrl.test.ts, frontend/src/mocks/utils/validateClubId.ts
기존 클럽 신청 API 모킹, 검증 유틸리티, 하드코딩된 상수 및 모의 데이터 완전 제거.
빌드 및 개발 도구 설정
frontend/package.json, frontend/src/index.tsx, frontend/.storybook/preview.tsx
msw-storybook-addon 의존성 추가, MSW 워커 가져오기 경로 변경, Storybook에서 MSW 초기화 및 로더 구성.

예상 코드 리뷰 난이도

🎯 3 (보통) | ⏱️ ~25분

연관된 이슈

  • MOA-597: 홍보게시판 API 추가 — 이 PR은 홍보 게시판 목록 조회 및 글 추가 POST API를 구현하여 요청된 기능을 직접 충족합니다.

연관된 PR

제안 레이블

📬 API

제안 리뷰어

  • lepitaaar
  • oesnuj
  • suhyun113
🚥 Pre-merge checks | ✅ 3 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR includes significant out-of-scope changes: removal of withErrorHandling wrapper across multiple API files (applicants, application, auth, club, image) that are unrelated to promotion API or testing infrastructure objectives. Remove the withErrorHandling refactoring changes from API modules (applicants.ts, application.ts, auth.ts, club.ts, image.ts) as they extend beyond the stated PR objectives of adding promotion API and test infrastructure.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately describes the main changes: adding promotion API and establishing test infrastructure (MSW setup).
Linked Issues check ✅ Passed All coding requirements from MOA-597 are met: GET API for promotion list (getPromotionArticles) and POST API for creating articles (createPromotionArticle) are fully implemented.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/#1135-promotion-api-MOA-597

Important

Action Needed: IP Allowlist Update

If your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:

  • 136.113.208.247/32 (new)
  • 34.170.211.100/32
  • 35.222.179.152/32

Reviews will stop working after February 8, 2026 if the new IP is not added to your allowlist.


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 and usage tips.

@seongwon030 seongwon030 added ✨ Feature 기능 개발 ✅ Test test 관련(storybook, jest...) 💻 FE Frontend labels Feb 3, 2026
- ThemeProvider와 GlobalStyles로 styled-components 의존 컴포넌트 오류 해결
- 스토리북에서 공통 스타일을 동일하게 적용
Copy link
Contributor

@lepitaaar lepitaaar left a comment

Choose a reason for hiding this comment

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

홍보 게시판 API 구현 수고하셨습니다. 레이아웃만 추가하면 될듯하네요!

@seongwon030 seongwon030 merged commit f9605a6 into develop-fe Feb 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💻 FE Frontend ✨ Feature 기능 개발 ✅ Test test 관련(storybook, jest...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] MOA-597 홍보게시판 api 추가

2 participants

Comments