<Test infinite kotlin coroutine> I have a ViewMode...
# stackoverflow
u
Test infinite kotlin coroutine I have a ViewModel. When it's visible on screen, it's started. When user leaves the screen, it stops. While the ViewModel is started, I want to execute some code every 5 seconds. The code looks somewhat like this: fun onStart() { interval = launch(injectedDispatcher) { while (true) { doSomething() delay(5000.milliseconds) } } } fun onStop() { interval.cancel() } I want to write an integration test that will test this ViewModel along with...