Skip to content

✨ [OMF-338] 단위 테스트 추가 - 순수 비즈니스 로직 (PR 1/3)#155

Merged
KJaeKwan merged 3 commits into
developfrom
feat/OMF-338-unit-tests
May 12, 2026
Merged

✨ [OMF-338] 단위 테스트 추가 - 순수 비즈니스 로직 (PR 1/3)#155
KJaeKwan merged 3 commits into
developfrom
feat/OMF-338-unit-tests

Conversation

@KJaeKwan

@KJaeKwan KJaeKwan commented May 10, 2026

Copy link
Copy Markdown
Collaborator

✨ Related Issue

OMF-338 단위 테스트 작성 - 순수 비즈니스 로직 (PR 1/3)


📌 Task Details

전체 서비스 레이어 단위 테스트 작성 작업의 첫 번째 PR입니다.
외부 의존성 없이 테스트 가능한 순수 비즈니스 로직을 Mockito 기반으로 커버합니다.

테스트 대상 (총 37개 테스트 케이스)

  • DefaultSurveyRefundPolicyTest (8개) — 환불 금액 계산 로직

    • targetCount 0/음수 → 환불 0
    • completedCount ≥ targetCount → 환불 0
    • 전액 환불 / 절반 환불 / totalCoin < paidReward → 0
    • 소수점 내림 처리
  • QuestionConverterTest (10개) — 문항 타입 DTO↔Entity 변환

    • 전 문항 타입 커버: Choice, Rating, DateAnswer, Grid, Time, Default(Short)
    • toQuestionUpsertDto: null 필드 기본값 처리, 빈 리스트 등
  • SurveyExportServiceTest (13개) — CSV 빌딩 로직

    • 권한 체크 (SURVEY_FORBIDDEN, SURVEY_INFO_NOT_FOUND)
    • gender/age 필터에 따른 컬럼 포함 여부
    • BOM 포함 여부, 파일명 날짜/특수문자 처리
    • 콤마 포함 답변 CSV 이스케이프, 생년월일 나이 계산
  • DiscountCodeCommandServiceTest (6개) — 할인 코드 생성

    • 6자리 대문자+숫자 정규식 검증
    • 코드 중복 시 재시도 로직
    • 반복 생성 무작위성 검증

전체 PR 계획 (3개로 재구성)

PR 범위
PR 1/3 (현재) 순수 비즈니스 로직 (환불/변환/CSV/할인코드)
PR 2/3 Member 도메인
PR 3/3 잔여 서비스 레이어 전체 (Discount Query / Survey / Participation)

💬 Review Requirements (Optional)

없음

jaekwan added 2 commits May 10, 2026 15:06
- DefaultSurveyRefundPolicy: 환불 금액 계산 로직 8개 케이스
- QuestionConverter: DTO↔Entity 변환 로직 전 문항 타입 커버 (10개)
- SurveyExportService: CSV 빌딩 로직 13개 케이스 (권한, BOM, 이스케이프 등)
- DiscountCodeCommandService: 할인 코드 생성 및 중복 재시도 6개 케이스
@coderabbitai

coderabbitai Bot commented May 10, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@KJaeKwan has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 59 minutes and 52 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7ae465ed-6b25-42a7-b70a-839c50578a1d

📥 Commits

Reviewing files that changed from the base of the PR and between 1ce6463 and 4a18c93.

📒 Files selected for processing (5)
  • gradlew
  • src/test/java/OneQ/OnSurvey/domain/discount/service/DiscountCodeCommandServiceTest.java
  • src/test/java/OneQ/OnSurvey/domain/question/service/QuestionConverterTest.java
  • src/test/java/OneQ/OnSurvey/domain/survey/service/export/SurveyExportServiceTest.java
  • src/test/java/OneQ/OnSurvey/domain/survey/service/refund/DefaultSurveyRefundPolicyTest.java
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/OMF-338-unit-tests

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.

@KJaeKwan KJaeKwan self-assigned this May 10, 2026
@KJaeKwan KJaeKwan added the ✅test 테스트 관련 label May 10, 2026
@KJaeKwan KJaeKwan changed the title ✨ [OMF-338] 단위 테스트 추가 - 순수 비즈니스 로직 (PR 1/9) ✨ [OMF-338] 단위 테스트 추가 - 순수 비즈니스 로직 (PR 1/3) May 10, 2026
@KJaeKwan KJaeKwan merged commit 100ec79 into develop May 12, 2026
2 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.

1 participant