Skip to content

Commit

Permalink
test: 주문 저장 단위테스트 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
axhtl committed Aug 19, 2024
1 parent d822226 commit 7ebb435
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.store.clothstar.order.service

import io.kotest.matchers.ints.exactly
import io.mockk.every
import io.mockk.impl.annotations.InjectMockKs
import io.mockk.impl.annotations.MockK
Expand Down Expand Up @@ -30,6 +31,9 @@ import org.store.clothstar.order.domain.Order
import org.store.clothstar.order.domain.OrderDetail
import org.store.clothstar.order.domain.vo.*
import org.store.clothstar.order.dto.request.AddOrderDetailRequest
import org.store.clothstar.order.dto.request.CreateOrderDetailRequest
import org.store.clothstar.order.dto.request.CreateOrderRequest
import org.store.clothstar.order.dto.request.OrderRequestWrapper
import org.store.clothstar.order.dto.response.OrderResponse
import org.store.clothstar.order.repository.OrderDetailRepository
import org.store.clothstar.order.repository.OrderRepository
Expand Down Expand Up @@ -346,6 +350,20 @@ class OrderUserServiceTest {
verify(exactly = 1) { itemService.findByIdIn(listOf(itemId)) }
}

@Test
@DisplayName("주문 저장")
fun saveOrder() {
//given
val orderRequestWrapper = mockk<OrderRequestWrapper>()
every { orderUserService.saveOrder(orderRequestWrapper) } returns orderId

//when
orderUserService.saveOrder(orderRequestWrapper)

//then
verify(exactly = 1) { orderSaveFacade.saveOrder(orderRequestWrapper) }
}

@Test
@DisplayName("주문 상세 추가 - 성공 테스트")
fun addOrderDetail_success_test() {
Expand Down

0 comments on commit 7ebb435

Please sign in to comment.