fix(test): avoid observeAll() in MessageDaoRetentionTest (CI compile glitch)
The androidTest compile failed ONLY in CI with "Unresolved reference 'observeAll'"
on the single line using dao.observeAll(), while every other MessageDao call in the
same file resolved, the identical observeAll().first().map{}.toSet() in
LibreMailDatabaseTest compiled fine in the same unit, and the file compiled cleanly
locally (even `clean --no-build-cache`). That points to a Kotlin incremental-compilation
artifact specific to the newly-added file, not a code error.
Replace the observeAll()-based readback with explicit getById point lookups — a clearer
per-row assertion that also sidesteps the glitch. Verified on the API 37 emulator (5/5).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -5,10 +5,10 @@ import android.content.Context
|
||||
import androidx.room.Room
|
||||
import androidx.test.core.app.ApplicationProvider
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNotNull
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
@@ -138,10 +138,14 @@ class MessageDaoRetentionTest {
|
||||
|
||||
dao.deleteSyncedInWindowNotIn("acct", "INBOX", minWindowUid = 20, keepIds = listOf("kept"))
|
||||
|
||||
assertEquals(
|
||||
setOf("below", "kept", "search", "other-folder"),
|
||||
dao.observeAll().first().map { it.id }.toSet(),
|
||||
)
|
||||
// Read survivors back with point lookups (getById) rather than observeAll(): explicit about each
|
||||
// row's fate, and it keeps the assertion off the Flow API.
|
||||
assertNull("gone-1 is in-window and unkept -> deleted", dao.getById("gone-1"))
|
||||
assertNull("gone-2 is in-window and unkept -> deleted", dao.getById("gone-2"))
|
||||
assertNotNull("below-window history must survive", dao.getById("below"))
|
||||
assertNotNull("the kept row must survive", dao.getById("kept"))
|
||||
assertNotNull("search rows are not synced -> untouched", dao.getById("search"))
|
||||
assertNotNull("other folders are untouched", dao.getById("other-folder"))
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user