generated from pricelees/issue-pr-template
[#52] 만료 예약 / 일정 스케쥴링 작업 추가 및 동시성 처리를 위한 일부 코드 수정 #53
@ -1,9 +1,5 @@
|
||||
package com.sangdol.roomescape.schedule
|
||||
|
||||
import io.kotest.matchers.shouldBe
|
||||
import org.hamcrest.CoreMatchers.equalTo
|
||||
import org.springframework.data.repository.findByIdOrNull
|
||||
import org.springframework.http.HttpMethod
|
||||
import com.sangdol.common.types.web.HttpStatus
|
||||
import com.sangdol.roomescape.admin.infrastructure.persistence.AdminPermissionLevel
|
||||
import com.sangdol.roomescape.admin.infrastructure.persistence.AdminType
|
||||
@ -12,6 +8,10 @@ import com.sangdol.roomescape.schedule.exception.ScheduleErrorCode
|
||||
import com.sangdol.roomescape.schedule.infrastructure.persistence.ScheduleRepository
|
||||
import com.sangdol.roomescape.schedule.infrastructure.persistence.ScheduleStatus
|
||||
import com.sangdol.roomescape.supports.*
|
||||
import io.kotest.matchers.shouldBe
|
||||
import org.hamcrest.CoreMatchers.equalTo
|
||||
import org.springframework.data.repository.findByIdOrNull
|
||||
import org.springframework.http.HttpMethod
|
||||
import java.time.LocalDate
|
||||
import java.time.LocalTime
|
||||
|
||||
@ -20,7 +20,7 @@ class ScheduleApiTest(
|
||||
) : FunSpecSpringbootTest() {
|
||||
init {
|
||||
context("특정 매장 + 날짜의 일정 및 테마 정보를 조회한다.") {
|
||||
test("날짜가 오늘이면 현재 시간 이후의 정보만 조회된다.") {
|
||||
test("날짜가 당일이면 현재 시간 이후의 정보만 조회된다.") {
|
||||
val size = 3
|
||||
val date = LocalDate.now()
|
||||
val store = dummyInitializer.createStore()
|
||||
@ -31,7 +31,7 @@ class ScheduleApiTest(
|
||||
storeId = store.id,
|
||||
request = ScheduleFixture.createRequest.copy(
|
||||
date = date,
|
||||
time = LocalTime.now().plusHours(i.toLong())
|
||||
time = LocalTime.now().plusMinutes(i.toLong())
|
||||
)
|
||||
)
|
||||
}
|
||||
@ -45,13 +45,17 @@ class ScheduleApiTest(
|
||||
)
|
||||
}
|
||||
|
||||
val expectedSize = scheduleRepository.findAll().takeIf { it.isNotEmpty() }
|
||||
?.let { it.count { schedule -> schedule.date.isEqual(date) && schedule.time.isAfter(LocalTime.now()) } }
|
||||
?: throw AssertionError("initialize 작업에서 레코드가 저장되지 않음.")
|
||||
|
||||
runTest(
|
||||
on = {
|
||||
get("/stores/${store.id}/schedules?date=${date}")
|
||||
},
|
||||
expect = {
|
||||
statusCode(HttpStatus.OK.value())
|
||||
body("data.schedules.size()", equalTo(size))
|
||||
body("data.schedules.size()", equalTo(expectedSize))
|
||||
assertProperties(
|
||||
props = setOf("id", "startFrom", "endAt", "themeId", "themeName", "themeDifficulty", "status"),
|
||||
propsNameIfList = "schedules"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user