Skip to content

test: 알림 관련 통합 테스트 작성#399

Open
dh2906 wants to merge 1 commit intodevelopfrom
test/398-notification-integration-test
Open

test: 알림 관련 통합 테스트 작성#399
dh2906 wants to merge 1 commit intodevelopfrom
test/398-notification-integration-test

Conversation

@dh2906
Copy link
Contributor

@dh2906 dh2906 commented Mar 17, 2026

🔍 개요

  • 알림 관련 통합 테스트 코드를 작성한다.

🚀 주요 변경 내용


💬 참고 사항


✅ Checklist (완료 조건)

  • 코드 스타일 가이드 준수
  • 테스트 코드 포함됨
  • Reviewers / Assignees / Labels 지정 완료
  • 보안 및 민감 정보 검증 (API 키, 환경 변수, 개인정보 등)

@dh2906 dh2906 self-assigned this Mar 17, 2026
@dh2906 dh2906 added the 테스트 테스트 코드 관련 이슈입니다. label Mar 17, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b48fe84f-c4ec-435d-a172-695dade073df

📥 Commits

Reviewing files that changed from the base of the PR and between be59799 and d5c469e.

📒 Files selected for processing (1)
  • src/test/java/gg/agit/konect/integration/domain/notification/NotificationApiTest.java
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (1)
**/*

⚙️ CodeRabbit configuration file

**/*: 공통 리뷰 톤 가이드:

  • 모든 코멘트는 첫 줄에 [LEVEL: ...] 태그를 포함한다.
  • 과장된 표현 없이 사실 기반으로 작성한다.
  • 한 코멘트에는 하나의 이슈만 다룬다.
  • 코드 예시가 필요하면 최소 수정 예시를 제시한다.
  • 가독성/단순화/확장성 이슈를 발견하면 우선순위를 높여 코멘트한다.

Files:

  • src/test/java/gg/agit/konect/integration/domain/notification/NotificationApiTest.java
🔇 Additional comments (5)
src/test/java/gg/agit/konect/integration/domain/notification/NotificationApiTest.java (5)

1-32: [LEVEL: 승인] 테스트 상수 및 클래스 구조가 적절합니다.

Expo Push Token 형식(ExpoPushToken[...])을 사용한 상수 정의가 실제 시나리오를 잘 반영하고 있으며, INVALID_TOKEN은 유효하지 않은 형식을 명확히 표현합니다.


34-38: [LEVEL: 승인] 테스트 설정이 간결하고 명확합니다.

필요한 fixture만 생성하여 테스트 독립성을 유지하고 있습니다.


40-69: [LEVEL: 승인] GET 엔드포인트 테스트 커버리지가 적절합니다.

성공 케이스와 토큰 미존재 시 404 반환 케이스를 모두 검증하고 있으며, clearPersistenceContext()를 통해 영속성 컨텍스트를 적절히 관리하고 있습니다.


71-124: [LEVEL: 승인] POST 엔드포인트 테스트가 잘 구성되어 있습니다.

신규 등록, 기존 토큰 갱신, 유효하지 않은 토큰 검증까지 주요 시나리오를 모두 커버하며, 응답 상태와 데이터베이스 상태를 함께 검증하는 점이 좋습니다.


126-145: [LEVEL: 부정확한 코멘트] 제안된 테스트 케이스가 실제 구현과 맞지 않습니다.

DELETE 엔드포인트는 등록되지 않은 토큰 삭제 요청에 대해 404가 아닌 200 OK를 반환합니다(NotificationController 36번 줄). 서비스는 ifPresent() 패턴을 사용하여 멱등성 있는 삭제(idempotent delete)를 구현하고 있으므로, 토큰이 없으면 아무것도 삭제되지 않지만 성공으로 응답합니다.

GET은 요청된 리소스가 없으면 404를 반환하고 DELETE는 삭제 작업을 항상 성공으로 처리하는 것은 의도된 설계입니다. 따라서 추가 테스트 케이스를 추가하되, 실제 동작에 맞게 200 OK 응답을 검증해야 합니다.


📝 Walkthrough

Walkthrough

알림 토큰 엔드포인트(/notifications/tokens)에 대한 통합 테스트 스위트를 추가합니다. 새로운 테스트 클래스는 GET, POST, DELETE 요청에 대해 성공 케이스, 누락 케이스, 유효하지 않은 입력 케이스 등을 검증합니다.

Changes

Cohort / File(s) Summary
알림 API 통합 테스트
src/test/java/gg/agit/konect/integration/domain/notification/NotificationApiTest.java
/notifications/tokens 엔드포인트에 대한 통합 테스트 추가. GET(성공/미존재), POST(등록/갱신/유효하지 않은 토큰), DELETE 작업을 검증하는 4개의 중첩 클래스(GetMyToken, RegisterToken, DeleteToken)와 7개의 테스트 메서드 포함.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 토큰 테스트를 더하면,
API는 춤을 춘다네!
GET, POST, DELETE 모두 검증하고,
엣지 케이스도 놓치지 않으니 ✨
품질은 쭉쭉 올라가더라 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 변경 사항의 주요 내용을 명확하게 설명합니다. 알림 관련 통합 테스트 추가라는 핵심 변경 사항을 정확히 반영하고 있습니다.
Description check ✅ Passed PR 설명이 알림 관련 통합 테스트 작성이라는 변경 사항과 관련이 있으며, 체크리스트가 완료되었습니다.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/398-notification-integration-test
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

You can disable poems in the walkthrough.

Disable the reviews.poem setting to disable the poems in the walkthrough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

테스트 테스트 코드 관련 이슈입니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant