Skip to content

[Test] Cart API Test#240

Merged
isak-kang merged 7 commits into
developfrom
test/#200-cart-api
Oct 29, 2025
Merged

[Test] Cart API Test#240
isak-kang merged 7 commits into
developfrom
test/#200-cart-api

Conversation

@growingpsy

@growingpsy growingpsy commented Oct 29, 2025

Copy link
Copy Markdown
Contributor

🛠️ Issue Number

closes #200

📌 작업 내용 및 특이사항

Cart(장바구니) API Test

  • 장바구니 추가 API 테스트 (POST /carts)
  • 장바구니 목록 조회 API 테스트 (GET /carts)
  • 장바구니 수량 수정 API 테스트 (PATCH /carts/{cartId})
  • 장바구니 삭제 API 테스트 (DELETE /carts/{cartId})
image

성공 케이스 중심으로 테스트 코드 작성 및 문서화 (Spring REST Docs 적용)
CartRepository에 ProductImage fetch join 추가로 N+1 문제 개선
MockMvc 기반 단위 테스트 환경 구성 (SecurityTestConfig, TestConfig 연동)
REST Docs 스니펫(cart-create, cart-get-list, cart-update, cart-delete) 생성

📚 참고사항

  • 추후 할인, 쿠폰 적용 로직 연동 예정

- Cart → OptionValue → OptionGroup → Product → ProductImage 경로에 LEFT JOIN FETCH 추가
- 장바구니 조회 시 상품 이미지 지연로딩 제거로 성능 개선
- CartController CRUD API 테스트 코드 작성 (MockMvc 기반)
- 장바구니 생성, 조회, 수정, 삭제 성공 케이스 검증
- Spring REST Docs 스니펫(cart-create, cart-get-list, cart-update, cart-delete) 생성
- TestConfig 적용으로 Mock 서비스 주입
- CartRepository fetch join 개선 반영
@isak-kang isak-kang added the ✅ test 테스트를 작성, 또는 수정합니다. label Oct 29, 2025
@isak-kang isak-kang added this to the Sprint 3 milestone Oct 29, 2025
- CartCreateRequest에서 memberId 필드 제거 (토큰 기반 회원 식별로 변경)
- CartResponse에 cartId 포함하여 생성 후 식별 가능하도록 수정
- CartController 및 CartControllerTest 로직 수정
- REST Docs 스니펫 응답 필드(cartId) 반영

@willjsw willjsw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@isak-kang
isak-kang merged commit c0957fc into develop Oct 29, 2025
1 check failed
isak-kang added a commit that referenced this pull request Oct 29, 2025
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.

[Test] Cart API 테스트

3 participants