I am trying to test a flow with a delay by using Turbain and CoroutineTest library. Does anybody know What I am missing here?
@Test
fun test(){
val flow = flow<Int> {
emit(1)
delay(1000)
emit(2)
}
runBlockingTest {
flow.test(Duration.INFINITE) {
expectItem()
expectItem()
expectComplete()
}
}
}
Here is the error I am getting.
kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 9223372036854775807 ms