Marcin Wisniowski
08/21/2024, 3:26 PMdelay()
. By using coroutineTestScope = true
, Kotest is correctly skipping the delay and I can test the output. However, I also want to test that it delays for the correct amount of time. How can I check how much virtual time has elapsed? I thought testCoroutineScheduler.currentTime
would tell me, but it returns 0
.Adam S
08/21/2024, 3:32 PMAdam S
08/21/2024, 3:33 PMSam
08/22/2024, 6:46 AMdelay()
in your test itself. E.g.
delay(expectedDuration - 1)
assert(thing.isNotDone)
delay(1)
assert(thing.isDone)
Marcin Wisniowski
08/22/2024, 8:00 AMSam
08/22/2024, 8:03 AMMarcin Wisniowski
08/22/2024, 8:04 AMSam
08/22/2024, 8:20 AMasync
coroutine, and then you can use its Deferred
result to check whether it's finished.