Skip to content

test(seller): SellerRepository spec 추가 (P2-1)#120

Merged
chanwoo7 merged 1 commit into
developfrom
test/seller-repository-spec
May 31, 2026
Merged

test(seller): SellerRepository spec 추가 (P2-1)#120
chanwoo7 merged 1 commit into
developfrom
test/seller-repository-spec

Conversation

@chanwoo7
Copy link
Copy Markdown
Member

Summary

P2-1. SellerRepository (449 줄 / 27 async + 3 export fn) 에 spec 부재 — coverage 0%. AuthRepository / UserRepository 와 같은 testcontainers/mysql 기반 real DB spec 추가로 정합.

Scope

신규 파일 1 개: src/features/seller/repositories/seller.repository.spec.ts (41 cases)

그룹별 커버 범위

그룹 메서드 케이스
account/store context findSellerAccountContext, findStoreBySellerAccountId, findStoreOwnership, updateStore store 동반 / store 없는 SELLER / 미존재 null / ownership query / 단순 update
business hours listStoreBusinessHours, upsertStoreBusinessHour day_of_week 오름차순 정렬 / upsert 신규 + 갱신 (같은 store+day 1 row)
special closure createStoreSpecialClosure (신규/soft-delete 복구), updateStoreSpecialClosure, findStoreSpecialClosureById, softDeleteStoreSpecialClosure, listStoreSpecialClosures upsert 복구 분기 / ownership / softDelete / cursor + limit
daily capacity createStoreDailyCapacity (신규/복구), updateStoreDailyCapacity, findStoreDailyCapacityById, softDeleteStoreDailyCapacity, listStoreDailyCapacities upsert 복구 / ownership / fromDate / toDate / cursor / 필터 없음 분기
faq topic listFaqTopics, createFaqTopic, findFaqTopicById, updateFaqTopic, softDeleteFaqTopic sort_order + id 정렬 / ownership / softDelete
banner listBannersByStore, findBannerByIdForStore, createBanner, updateBanner, softDeleteBanner link_store_id 직접 vs link_product.store_id 양 경로 / cursor + limit / ownership
audit log listAuditLogsBySeller actor OR storeId OR 조건 / targetType 필터 / cursor + limit
standalone fn normalizeCursorInput, nextCursorOf, isSellerAccount limit clamp (0/1000/50, null) / cursor null / nextCursor null / sliced / AccountType 매칭

패턴

  • createTestingModuleWithRealDb({ providers: [SellerRepository] }) + truncateAll() 매 케이스 격리 — AccountRepository spec 과 동일
  • factory: setupSellerWithStore, createAccount, createProduct, createStore
  • ownership 케이스는 me + other 두 seller setup 후 cross-store query 가 null 인지 확인 (B-1 정합성 가드와 같은 흐름)

Impact

  • FE: 없음
  • DB: 변경 없음
  • Production 코드: 변경 없음
  • Coverage: seller.repository.ts 0/0/0/0 → 100/96.29/100/100 (미커버 line 438 은 defensive ?? null fallback 으로 자연 실행 불가)
  • 전체 테스트 1199 → 1240 (+41), pre-push gate 통과

Test plan

  • 41 신규 케이스 모두 통과
  • seller.repository.ts coverage 100/96.29/100/100 달성
  • pre-push gate (yarn validate) 로컬 통과
  • CI 통과 확인

기존 spec 부재 (커버리지 0%) 상태였던 SellerRepository (449줄 / 27 async + 3 export fn) 에
testcontainers/mysql 기반 real DB spec 추가. AuthRepository / UserRepository 의 spec 패턴 일관.

커버 범위:
- account/store context (findSellerAccountContext, findStoreBySellerAccountId, findStoreOwnership, updateStore)
- business hours (list, upsert — 신규/갱신)
- special closure (create 신규/soft-delete 복구, update, findById ownership, softDelete, list cursor/limit)
- daily capacity (create 신규/복구, update, findById ownership, softDelete, list fromDate/toDate 필터+cursor)
- faq topic (list 정렬, create, findById ownership, update, softDelete)
- banner (list link_store_id/link_product 양 경로 ownership, cursor/limit, findById ownership, create+update+softDelete)
- audit log (actor OR storeId 매칭, targetType 필터, cursor/limit)
- standalone fn: normalizeCursorInput (clamp/null), nextCursorOf, isSellerAccount

41 cases 추가. seller.repository.ts coverage 0/0/0/0 → 100/96.29/100/100.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 31, 2026

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: b2f7ec84-c673-4adc-a41c-835c412e688f

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/seller-repository-spec

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.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions
Copy link
Copy Markdown

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 97.36% 3542/3638
🟢 Branches 93.84% 1128/1202
🟢 Functions 93.77% 647/690
🟢 Lines 97.59% 3242/3322

Test suite run success

1240 tests passing in 144 suites.

Report generated by 🧪jest coverage report action from db47736

@chanwoo7 chanwoo7 merged commit c6c14e7 into develop May 31, 2026
10 checks passed
@chanwoo7 chanwoo7 deleted the test/seller-repository-spec branch May 31, 2026 17:09
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