Hakon Grotte
12/12/2022, 11:07 AMFlow
? I am trying to do with turbine and `TestCoroutineScheduler.currentTime`:
runTest {
val myFlow: Flow<Int> = flow<Int> {
(1..5).forEach {
delay(100)
emit(it)
}
}
myFlow.test {
repeat(5) {
awaitItem()
println(testScheduler.currentTime)
}
awaitComplete()
}
}
The described approach does not work: For each run my test prints different/random values, e.g. "300,500,500,500,500 " etc.
I have tried using the myFlow.flowOn()
operator with both test dispatchers available.alex.krupa
12/12/2022, 11:47 AMrunTest
changed between versions.Hakon Grotte
12/12/2022, 12:08 PMTestScheduler
(such as inside runTest
)."
Thank you!