File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
src/test/kotlin/infrastructure/api Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import application.presenter.api.model.EnvironmentalDataApiDto
1212import application.presenter.api.model.RoomApiDto
1313import application.presenter.api.model.RoomApiDtoType
1414import application.presenter.api.model.RoomEntry
15+ import entity.zone.RoomEnvironmentalData
1516import infrastructure.api.KtorTestingUtility.apiTestApplication
1617import infrastructure.api.util.ApiResponses
1718import io.kotest.assertions.ktor.client.shouldHaveStatus
@@ -126,4 +127,22 @@ class RoomApiTest : StringSpec({
126127 client.delete("/api/v1/rooms/${roomEntry.id}") shouldHaveStatus HttpStatusCode .NotFound
127128 }
128129 }
130+
131+ " It should be possible to ask for historical room environmental data of an existing room" {
132+ apiTestApplication {
133+ insertRoom(roomEntry)
134+ val response = client.get("/api/v1/rooms/data/${roomEntry.id}")
135+ response shouldHaveStatus HttpStatusCode .OK
136+ Json .decodeFromString<ApiResponses .ResponseEntryList <ApiResponses .ResponseTimedEntry <
137+ RoomEnvironmentalData >>>(
138+ response.bodyAsText()
139+ ).total shouldBe 0
140+ }
141+ }
142+
143+ " It should handle the get request on the historical room environmental data of a non existing room" {
144+ apiTestApplication {
145+ client.get("/api/v1/rooms/data/${roomEntry.id}") shouldHaveStatus HttpStatusCode .NotFound
146+ }
147+ }
129148})
You can’t perform that action at this time.
0 commit comments