Skip to content

Commit 8c6ac38

Browse files
test: add tests for room historical data extractor service
1 parent 24793f4 commit 8c6ac38

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/test/kotlin/application/service/RoomServiceTest.kt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,35 @@ class RoomServiceTest : StringSpec({
145145
).execute() shouldBe false
146146
}
147147
}
148+
149+
"It should be possible to extract the historical room environmental data of an existing room" {
150+
withMongo {
151+
val roomController = controller()
152+
RoomService.CreateRoom(exampleRoom, roomController).execute()
153+
RoomService.UpdateRoomEnvironmentData(
154+
exampleRoom.id,
155+
RoomEnvironmentalData(humidity = Humidity(55.0)),
156+
Instant.now().minus(1, ChronoUnit.DAYS),
157+
roomController
158+
).execute()
159+
RoomService.ExportRoomEnvironmentalData(
160+
exampleRoom.id,
161+
roomController,
162+
Instant.now().minus(2, ChronoUnit.DAYS),
163+
Instant.now()
164+
).execute()?.size shouldBe 1
165+
}
166+
}
167+
168+
"It should not be possible to extract historical room environmental data of a room that doesn't exist" {
169+
withMongo {
170+
val roomController = controller()
171+
RoomService.ExportRoomEnvironmentalData(
172+
exampleRoom.id,
173+
roomController,
174+
Instant.now().minus(2, ChronoUnit.DAYS),
175+
Instant.now()
176+
).execute() shouldBe null
177+
}
178+
}
148179
})

0 commit comments

Comments
 (0)