generated from pricelees/issue-pr-template
refactor: \@SpringBootTest 에서의 테스트 종료 후 테이블 롤백 스크립트 적용
This commit is contained in:
parent
bc8ab29355
commit
f517752e44
@ -8,6 +8,7 @@ import jakarta.persistence.EntityManager
|
|||||||
import org.hamcrest.Matchers.equalTo
|
import org.hamcrest.Matchers.equalTo
|
||||||
import org.springframework.boot.test.context.SpringBootTest
|
import org.springframework.boot.test.context.SpringBootTest
|
||||||
import org.springframework.boot.test.web.server.LocalServerPort
|
import org.springframework.boot.test.web.server.LocalServerPort
|
||||||
|
import org.springframework.test.context.jdbc.Sql
|
||||||
import org.springframework.transaction.support.TransactionTemplate
|
import org.springframework.transaction.support.TransactionTemplate
|
||||||
import roomescape.theme.business.ThemeService
|
import roomescape.theme.business.ThemeService
|
||||||
import roomescape.theme.util.TestThemeCreateUtil
|
import roomescape.theme.util.TestThemeCreateUtil
|
||||||
@ -20,13 +21,13 @@ import kotlin.random.Random
|
|||||||
* 날짜 범위, 예약 수만 검증
|
* 날짜 범위, 예약 수만 검증
|
||||||
*/
|
*/
|
||||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
|
@Sql(value = ["/truncate.sql"], executionPhase = Sql.ExecutionPhase.AFTER_TEST_CLASS)
|
||||||
class MostReservedThemeAPITest(
|
class MostReservedThemeAPITest(
|
||||||
@LocalServerPort val port: Int,
|
@LocalServerPort val port: Int,
|
||||||
val themeService: ThemeService,
|
val themeService: ThemeService,
|
||||||
val transactionTemplate: TransactionTemplate,
|
val transactionTemplate: TransactionTemplate,
|
||||||
val entityManager: EntityManager,
|
val entityManager: EntityManager,
|
||||||
) : FunSpec() {
|
) : FunSpec() {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
beforeSpec {
|
beforeSpec {
|
||||||
transactionTemplate.executeWithoutResult {
|
transactionTemplate.executeWithoutResult {
|
||||||
@ -50,7 +51,7 @@ class MostReservedThemeAPITest(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
context("가장 많이 예약된 테마를 조회할 때,") {
|
context("가장 많이 예약된 테마를 조회할 때, ") {
|
||||||
val endpoint = "/themes/most-reserved-last-week"
|
val endpoint = "/themes/most-reserved-last-week"
|
||||||
test("갯수를 입력하지 않으면 10개를 반환한다.") {
|
test("갯수를 입력하지 않으면 10개를 반환한다.") {
|
||||||
Given {
|
Given {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user