From be89bcc6d92beeec3d3f0240ca4b7d2cf8df87b9 Mon Sep 17 00:00:00 2001 From: Jason Ross Date: Fri, 3 Jul 2026 19:02:57 -0500 Subject: [PATCH] test(coverage): align lane-3 data/local tests with #234 casefold search + schema v19 PR #234 (issue #232, merged into this branch) bumped the Room schema 18->19 and made the MessageDao search queries match Unicode-casefolded *Fold columns. Two lane-3 tests were stale against it: - DatabaseEncryptionTest.schemaVersionIsCarriedOntoTheEncryptedFile hardcoded the pre-#234 schema version 18; bump to 19 (matches LibreMailDatabase version = 19). - MessageDaoTest's search-summary tests inserted MessageEntity fixtures without populating the new senderFold/senderEmailFold/subjectFold/snippetFold columns, so the casefolded LIKE matched nothing ([]). Populate them in the message() helper via lowercase(), mirroring production (Mappers.toEntity + MessageDao.updateHeaderContent/updateBody). MigrationTest already covers 18->19 (migrate18To19_addsAndBackfillsCasefoldSearchColumns plus the auto-discovered full-chain replays), so no change there. Verified: targeted connectedDebugAndroidTest of MessageDaoTest+DatabaseEncryptionTest+MigrationTest on the API 36 emulator = 32 tests, 0 failures. Co-Authored-By: Claude Opus 4.8 --- .../org/libremail/data/local/DatabaseEncryptionTest.kt | 2 +- .../kotlin/org/libremail/data/local/MessageDaoTest.kt | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/androidTest/kotlin/org/libremail/data/local/DatabaseEncryptionTest.kt b/app/src/androidTest/kotlin/org/libremail/data/local/DatabaseEncryptionTest.kt index 325f813..53609ee 100644 --- a/app/src/androidTest/kotlin/org/libremail/data/local/DatabaseEncryptionTest.kt +++ b/app/src/androidTest/kotlin/org/libremail/data/local/DatabaseEncryptionTest.kt @@ -147,7 +147,7 @@ class DatabaseEncryptionTest { } finally { encrypted.close() } - assertEquals("Room's schema version must survive the plaintext -> encrypted conversion", 18, version) + assertEquals("Room's schema version must survive the plaintext -> encrypted conversion", 19, version) } private fun openPlaintext(): LibreMailDatabase = diff --git a/app/src/androidTest/kotlin/org/libremail/data/local/MessageDaoTest.kt b/app/src/androidTest/kotlin/org/libremail/data/local/MessageDaoTest.kt index 5a66ee6..0d875d9 100644 --- a/app/src/androidTest/kotlin/org/libremail/data/local/MessageDaoTest.kt +++ b/app/src/androidTest/kotlin/org/libremail/data/local/MessageDaoTest.kt @@ -76,6 +76,13 @@ class MessageDaoTest { inInbox = inInbox, bodyFetched = bodyFetched, uid = uid, + // Mirror production's Unicode-casefold population (issue #232): Mappers.toEntity + MessageDao's + // updateHeaderContent/updateBody write `lowercase()` copies of the searchable fields, and the + // *SearchSummaries queries match against these `*Fold` columns — so fixtures must set them too. + senderFold = sender.lowercase(), + senderEmailFold = senderEmail.lowercase(), + subjectFold = subject.lowercase(), + snippetFold = snippet.lowercase(), ) /** Refreshes a [PagingSource] and returns the first loaded page's ids in order. */