-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
주문 단위테스트 구현 #28
Merged
Merged
주문 단위테스트 구현 #28
Conversation
This file contains 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
upswp
suggested changes
Aug 21, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 부분 한번 수정부탁드립니다!
Comment on lines
+100
to
+144
every { orderRepository.findConfirmedAndNotDeletedOrders() } returns listOf(order) | ||
every { order.memberId } returns memberId | ||
every { order.addressId } returns addressId | ||
every { memberService.getMemberByMemberId(memberId) } returns member | ||
every { addressService.getAddressById(addressId) } returns address | ||
every { sellerService.getSellerById(memberId) } returns seller | ||
|
||
every { totalPrice.shipping } returns 3000 | ||
every { totalPrice.products } returns 5000 | ||
every { totalPrice.payment } returns 8000 | ||
every { order.orderId } returns orderId | ||
every { member.name } returns "수빈" | ||
every { order.createdAt } returns LocalDateTime.now() | ||
every { order.status } returns Status.CONFIRMED | ||
every { order.paymentMethod } returns PaymentMethod.CARD | ||
every { order.totalPrice } returns totalPrice | ||
every { address.addressInfo } returns addressInfo | ||
every { address.receiverName } returns "수빈" | ||
every { addressInfo.addressBasic } returns "address1" | ||
every { addressInfo.addressDetail } returns "address2" | ||
every { address.telNo } returns "010-1111-1111" | ||
every { address.deliveryRequest } returns "문앞" | ||
|
||
val expectedorderResponse = OrderResponse.from(order, member, address) | ||
every { order.orderDetails } returns mutableListOf(orderDetail) | ||
every { orderDetail.deletedAt } returns null | ||
|
||
// productIds, itemIds로부터 Product/Item 리스트 가져오기 | ||
every { orderDetail.itemId } returns itemId | ||
every { orderDetail.productId } returns productId | ||
every { productService.findByProductIdIn(listOf(productId)) } returns listOf(product) | ||
every { itemService.findByIdIn(listOf(itemId)) } returns listOf(item) | ||
|
||
every { item.itemId } returns itemId | ||
every { product.productId } returns productId | ||
|
||
every { orderDetail.orderDetailId } returns 1L | ||
every { product.name } returns "상품이름" | ||
every { item.name } returns "상품옵션이름" | ||
every { seller.brandName } returns "brandName" | ||
every { product.price } returns 1000 | ||
every { orderDetail.quantity } returns 1 | ||
every { orderDetail.price } returns price | ||
every { item.finalPrice } returns 10000 | ||
every { price.oneKindTotalPrice } returns 10000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mockk를 사용하면서 테스트하고자 하는 범위를 좁히시면 좋겠습니다.
mockk<Order>(){
every { order.name } returnThan? = "000"
axhtl
force-pushed
the
test/order-unit
branch
from
September 5, 2024 21:28
7ebb435
to
0029dfe
Compare
axhtl
force-pushed
the
test/order-unit
branch
from
September 6, 2024 15:14
0029dfe
to
1dad90c
Compare
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.
단위 테스트를 구현하였습니다.
OrderSeller
OrderUser