Skip to content

[Test] Admin 도메인 테스트 코드 작성 (#174)#176

Merged
seoyeon83 merged 1 commit into
devfrom
test/#174-admin
Jun 26, 2026
Merged

[Test] Admin 도메인 테스트 코드 작성 (#174)#176
seoyeon83 merged 1 commit into
devfrom
test/#174-admin

Conversation

@seoyeon83

@seoyeon83 seoyeon83 commented Jun 26, 2026

Copy link
Copy Markdown
Member

💡 개요

Admin(관리자 계정) 도메인 테스트 코드를 4계층으로 작성합니다. admin 은 테스트 코드가 전혀 없던 유일한 도메인이었고, 코드 기준 명세서(docs/test/TC-ADMIN-001~007)를 바탕으로 작성했습니다.

🪐 주요 변경 사항

  • AdminServiceTest (Mockito): 계정 CRUD·비밀번호·권한 분기 단위 테스트 (32)
  • AdminControllerTest (@WebMvcTest): HTTP 계약·@Valid·Security 슬라이스 (26)
  • AdminRepositoryTest (@DataJpaTest + Testcontainers): 커스텀 쿼리 검증 (8)
  • AdminIntegrationTest (@SpringBootTest + Testcontainers): end-to-end 흐름 (9)
  • 합계 75 tests, 전부 통과

✅ 상세 내용

  • ADMIN-001~007: 모든 계정 조회 / 계정 생성 / 내 계정 조회(getMe) / id별 조회·수정·삭제 / 비밀번호 초기화·변경
  • 권한 분기(SUPER·TEAM·본인), soft delete 제외·정렬, RefreshToken 삭제(role 변경·삭제·비번 변경), JsonNullable 부분 수정, 마지막 SUPER 삭제 가드, password BCrypt 해시 검증 등
  • Repository: findAll…OrderByCreatedAtAsc, existsByUsername…, findById…, countByRole…, 평가자 풀 쿼리 등 soft delete 조건/정렬 검증

🔔 참고 사항

  • 권한 거부 상태코드는 코드 기준 401(ErrorCode.UNAUTHORIZED)로 단언 (노션 명세 403 표기와 불일치 — 팀 정렬 필요)
  • ADMIN-007(getMe)은 DB 접근이 없어 Repository 계층 테스트 없음
  • @WebMvcTest 슬라이스에 JacksonConfig 미로딩으로 JsonNullable PATCH 본문이 깨지던 것 → @Import 에 추가해 해결
  • 테스트 명세서(docs/test/TC-ADMIN-*)는 gitignore 대상이라 본 PR 에 미포함

…tion)

- AdminServiceTest: 계정 CRUD·비밀번호·권한 분기 단위 테스트 (Mockito)
- AdminControllerTest: HTTP 계약·@Valid·Security 슬라이스 (@WebMvcTest)
- AdminRepositoryTest: soft delete 제외·정렬·평가자 풀 커스텀 쿼리 (@DataJpaTest)
- AdminIntegrationTest: 생성/수정/삭제/비번 end-to-end + RefreshToken 삭제 (@SpringBootTest)
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 50746e64-70e2-4368-a88b-1d3f58a53bc9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/#174-admin

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.

@seoyeon83 seoyeon83 self-assigned this Jun 26, 2026
@seoyeon83
seoyeon83 merged commit cbf2273 into dev Jun 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant