I have a test for my ViewModel in android. everything works fine.
I had to add a
Copy code
closeableScope.launch {
}
and now that I did that, my test times out. if i remove the
blah.collectLatest {}
then it passes. Anyone have tips on what to do in this scenario. im still a rookie when it comes to testing, especially coroutines/flows
m
mkrussel
12/22/2023, 3:30 PM
runTests
waits for all child jobs to finish. If nothing cancels the launched job and if the flow doesn't complete, then the job will keep running and the test will time out.
hm... let me try it out. i am injecting a closeableScope to my VM to make it testable and get around all of the Main.dispatcher stuff. but I typically pass in the runTest { coroutineContext } into the VM as the closeableScope