Is there any documentation on how to handle `delay...
# compose
k
Is there any documentation on how to handle
delay
inside
LaunchedEffect
coroutine scope in androidTests? I am unable to test if following lambda has been called when
delay
is present.
Copy code
LaunchedEffect(Unit){
    delay(splashTime)
    navigate(viewModel.isAuthenticated())
}
runBlockingTest
and
advanceTimeBy()
do not help.
z
I think you can use the `ComposeTestRule`’s
mainClock
to control time on compose coroutines. https://developer.android.com/reference/kotlin/androidx/compose/ui/test/junit4/ComposeTestRule
k
This works. Thanks.
r
@K Merle what did you try? Are you getting composenotidle exception?
k
No, I've just advanced clock for
splashTime
and it works.