Skip to content

Commit

Permalink
refactor(purchase) : 테스트 케이스 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
zomeong committed Jan 27, 2024
1 parent 7d5599b commit 93d641d
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,27 @@ void getPurchaseListTest_success() {
//given
purchaseService.purchase(requestDto, member);

memberProduct = MemberProductTestUtil.getMemberProduct(member, product);
memberProductRepository.save(memberProduct);
purchaseService.purchase(requestDto, member);

//when
List<PurchaseResponseDto> responseDtoList = purchaseService.getPurchaseList(member);

//then
assertEquals(1, responseDtoList.size());
assertEquals(2, responseDtoList.size());

assertEquals(requestDto.getAddress(), responseDtoList.get(0).getAddress());
assertEquals(memberProduct.getProductsQuantity() * product.getPrice(),
responseDtoList.get(0).getTotalPrice());
assertEquals(product.getTitle(),
responseDtoList.get(0).getPurchaseProductList().get(0).getTitle());
assertEquals(memberProduct.getProductsQuantity(),
responseDtoList.get(0).getPurchaseProductList().get(0).getProductsQuantity());

assertEquals(requestDto.getAddress(), responseDtoList.get(1).getAddress());
assertEquals(product.getTitle(),
responseDtoList.get(1).getPurchaseProductList().get(0).getTitle());
}

@Test
Expand Down

0 comments on commit 93d641d

Please sign in to comment.