pseudocode: ``` fun funToTest() = async { regis...
# coroutines
a
pseudocode:
Copy code
fun funToTest() = async {
   registerDevice()
   //... and lots of extra logic here
}

private suspend fun registerDevice() = suspendCoroutine {
 // handle complex callback logic and do it.resume(data) for suspendCoroutine
}
m
Since your
funToTest
returns a
Deferred
, all you have to do in your test is call
await()
on it (the test itself should be within
runBlocking
).