Marcos Nathan
02/15/2026, 7:44 PM@Dao
interface ApplicationResourceDao{
@Transaction
@Query("SELECT * FROM application_resources")
fun getAll(): Flow<List<ApplicationResourceEntity>>
}
on the test side, I'm doing like that:
@Test
fun getApplications() = runTest {
insertApplicationResources()
val allApplications = applicationResourceDao.getAll().toList()
assertEquals(2, allApplications.size)
}
but I'm getting infinite loop on the getAll due to the Flow. how can I test a flow on this case?zsmb
02/15/2026, 9:15 PMJack Boswell
02/16/2026, 12:03 AMtoList collects all emissions and continues until the Flow completes, but a Flow from Room will never completed on its own.
You probably meant to grab the first list of items from the database with firstMarcos Nathan
02/17/2026, 3:20 AM