Does any one have unit test recommendation for tes...
# coroutines
s
Does any one have unit test recommendation for testing coroutine launched from Android's ViewModel scope? I'm able to pass a Unconfined dispatcher from unit tests to work around the Main looper uninitialized case. However, mockito verify fails as expected call and actual call differs in continuation
s
Did you try using the
TestCoroutineContext
instead of the Unconfined one?
m
Did you try writing your tests like this?
Copy code
@Test
fun test() = runBlocking { /* TEST */ }