generated from pricelees/issue-pr-template
44 lines
1.4 KiB
Kotlin
44 lines
1.4 KiB
Kotlin
package roomescape.region
|
|
|
|
import io.kotest.matchers.shouldBe
|
|
import org.springframework.http.HttpStatus
|
|
import roomescape.supports.FunSpecSpringbootTest
|
|
import roomescape.supports.runTest
|
|
|
|
class RegionApiSuccessTest: FunSpecSpringbootTest() {
|
|
init {
|
|
context("시/도 -> 시/군/구 -> 지역 코드 순으로 조회한다.") {
|
|
test("정상 응답") {
|
|
val sidoCode: String = runTest(
|
|
on = {
|
|
get("/regions/sido")
|
|
},
|
|
expect = {
|
|
statusCode(HttpStatus.OK.value())
|
|
}
|
|
).extract().path("data.sidoList[0].code")
|
|
|
|
val sigunguCode: String = runTest(
|
|
on = {
|
|
get("/regions/sigungu?sidoCode=$sidoCode")
|
|
},
|
|
expect = {
|
|
statusCode(HttpStatus.OK.value())
|
|
}
|
|
).extract().path("data.sigunguList[0].code")
|
|
|
|
val regionCode: String = runTest(
|
|
on = {
|
|
get("/regions/code?sidoCode=$sidoCode&sigunguCode=$sigunguCode")
|
|
},
|
|
expect = {
|
|
statusCode(HttpStatus.OK.value())
|
|
}
|
|
).extract().path("data.code")
|
|
|
|
regionCode shouldBe "$sidoCode${sigunguCode}00000"
|
|
}
|
|
}
|
|
}
|
|
}
|