matt tighe
09/06/2019, 7:53 PM@Test
fun listCanBeObserved() = runBlocking {
dao.insert(thing)
val data: List<Thing> = dao.observeAll().single()
val expected = Thing()
assertEquals(expected, data)
}
but if I manually collect each emission I can see the assertion is hit successfully in debug mode
fun listCanBeObserved() = runBlocking {
dao.insert(thing)
val data: List<Thing> = dao.observeAll().collect {
val expected = Thing()
assertEquals(expected, data)
}
}
but then the test will never completeDominaezzz
09/06/2019, 8:05 PMfirst()
matt tighe
09/06/2019, 8:06 PMexpected
is listOf(thing)
single()
is kind of misleading then, i’d expect it to do the same thingDominaezzz
09/06/2019, 8:13 PMmatt tighe
09/06/2019, 8:23 PM