ursus
12/03/2021, 1:19 PMclass Syncer(private val db: Db) {
private val scope = CoroutineScope(SupervisorJob + Dispatchers Io)
fun sync() {
scope.launch {
...
db.insertSomething()
}
}
}
I'd like to assert that db.readSomething()
reads what it should after I call Syncer.sync()
There is nothing to suspend on to know when the sync actually finished (like some status flow)
Is injecting Dispatchers.Undispatched
instead of Io
to make it synchronous, so I can assert right after sync()
returns, idiomatic?
Is there something better?krzysztof
12/03/2021, 1:29 PMursus
12/03/2021, 1:31 PMstreetsofboston
12/03/2021, 1:53 PMursus
12/03/2021, 1:57 PM