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 <noreply@anthropic.com>
This commit is contained in:
@@ -147,7 +147,7 @@ class DatabaseEncryptionTest {
|
|||||||
} finally {
|
} finally {
|
||||||
encrypted.close()
|
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 =
|
private fun openPlaintext(): LibreMailDatabase =
|
||||||
|
|||||||
@@ -76,6 +76,13 @@ class MessageDaoTest {
|
|||||||
inInbox = inInbox,
|
inInbox = inInbox,
|
||||||
bodyFetched = bodyFetched,
|
bodyFetched = bodyFetched,
|
||||||
uid = uid,
|
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. */
|
/** Refreshes a [PagingSource] and returns the first loaded page's ids in order. */
|
||||||
|
|||||||
Reference in New Issue
Block a user