Conversation
기존에 작성한 통합/E2E 테스트 인프라를 전체적으로 리뷰한 결과, 가장 심각한 문제는 NotificationOrderDispatchService를 no-op으로 교체할 때 실제 인터페이스의 4개 public 메서드 중 handleOrderStatusTransition 하나만 있는 mock을 두 곳 (e2e app.ts, order-user-action 통합테스트)에서 각각 만들어 쓰고 있었던 것. OrderAutomationService가 나머지 3개(리마인더 발송)를 직접 호출하는데, 지금 테스트 데이터는 우연히 그 경로를 안 타서 통과했을 뿐 — 임시 테스트로 실제 재현해보니 old mock은 TypeError로 크래시했다. src/test/mocks.ts에 4개 메서드를 전부 갖춘 공용 mock 팩토리를 만들어 두 곳 모두 교체했다(재현 테스트는 확인 후 삭제). 그 외 리뷰에서 나온 사소한 개선: - Calendar 인터랙션 테스트의 not.toHaveBeenCalledWith(특정 날짜) 대신 not.toHaveBeenCalled()로 강화 (다른 날짜로 잘못 호출되는 회귀도 잡도록) - vitest.e2e.config.ts의 fileParallelism 관련 주석이 "Nest 앱 인스턴스 공유"라고 잘못 설명하고 있던 것 정정 (vitest는 파일마다 격리되므로 실제로 공유되는 건 DB뿐) - factories.ts의 테스트 전화번호 생성이 UUID 필터링 방식이라 이론상 8자리보다 짧아질 수 있던 것을 randomInt 기반으로 교체해 항상 정확히 8자리 보장 - auth-google-oauth 통합테스트의 랜덤 소스를 Math.random → randomUUID로 통일 - test-web.yml의 Playwright 캐시 키가 package.json의 semver range 문자열을 그대로 쓰고 있어 정확한 설치 버전으로 교체 (로컬에서 실제 hoisting 경로까지 확인 후 반영 — 처음 시도한 상대 경로 방식은 monorepo 호이스팅 때문에 실패하는 것을 확인하고 bare specifier 방식으로 수정) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Au6qVAM3RXf7rAakifYDcL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📋 요약
직전 PR(#170)로 만든 테스트 인프라(backend 유닛·DB통합·API E2E, web-user 유닛·Storybook 컴포넌트 테스트)를 전체 리뷰한 결과 발견한 문제들을 수정한다. 가장 심각한 것은 알림 서비스 mock이 실제 인터페이스의 일부 메서드만 갖추고 있어, 특정 조건의 주문 데이터에서는 테스트가 크래시할 수 있었던 문제다.
✨ 주요 변경사항
NotificationOrderDispatchService의 no-op mock을 공용 팩토리(src/test/mocks.ts)로 통일 — 기존엔 E2E 테스트와 order-user-action 통합테스트 두 곳에서 각각 불완전한 mock(handleOrderStatusTransition만 존재)을 만들어 썼는데, 실제 서비스엔 리마인더 발송용 메서드가 3개 더 있어 특정 주문 상태에서TypeError로 크래시할 수 있었음 (임시 재현 테스트로 실제 크래시 확인 후 수정)randomInt기반으로 교체 (이론상 8자리보다 짧아질 수 있던 결함 제거)vitest.e2e.config.ts의 잘못된 주석 정정, 통합테스트의 랜덤 소스를randomUUID로 통일not.toHaveBeenCalledWith(특정 날짜)에서not.toHaveBeenCalled()로 강화 (다른 날짜로 잘못 선택되는 회귀도 잡도록)test-web.yml의 Playwright 캐시 키를 package.json의 semver range 문자열 대신 실제 설치 버전으로 교체 (모노레포 호이스팅 구조를 고려해 bare specifier 방식으로 조회)🧪 테스트 계획
📎 참고 사항