Skip to content

Commit

Permalink
test(coupon) : 실패하는 테스트 코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
this-is-spear committed Jun 9, 2024
1 parent d44c8e7 commit 3bea3ca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.example.estdelivery.coupon.application.port.out.adapter.persistence.r
import com.example.estdelivery.coupon.domain.coupon.Coupon
import com.example.estdelivery.coupon.domain.coupon.CouponType
import io.kotest.matchers.shouldBe
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
Expand All @@ -28,6 +29,7 @@ class MemberAdapterTest(
@Autowired
private val couponRepository: CouponRepository,
) {
@BeforeEach
fun setUp() {
memberCouponRepository.deleteAll()
couponRepository.deleteAll()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,17 @@ class MemberPersistenceAdapterTest : FreeSpec({
member.receiveCoupon(나눠준_비율_할인_쿠폰)
val unusedCouponEntity = fromCoupon(나눠준_비율_할인_쿠폰)

every { memberCouponRepository.findByMemberIdAndCoupon(member.id, unusedCouponEntity) }
every {
memberCouponRepository.findByMemberIdAndCoupon(
member.id,
unusedCouponEntity
)
} returns MemberCouponEntity(
unusedCouponEntity,
member.id,
MemberCouponUseState.UNUSED,
1L
)
memberPersistenceAdapter.updateUnusedCouponBook(member.id, member.showMyCouponBook())
}
}
Expand Down

0 comments on commit 3bea3ca

Please sign in to comment.