From d9d50f190356f77fc1dfa4a32480ad3e3f93900d Mon Sep 17 00:00:00 2001 From: Jason Ross Date: Thu, 2 Jul 2026 06:37:07 -0500 Subject: [PATCH] fix(test): make instrumented migrator tests return Unit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `@Test fun x() = runBlocking { ... }` whose block ends in `.apply { }` returns the DB (non-Unit), so JUnit4 rejects the whole class at runtime with InvalidTestClassError ("method should be void") — which compiles fine locally but fails every E2E job on the emulator. Use `runBlocking` (the existing DatabaseEncryptionTest idiom) so the methods are void while keeping the expression body ktlint expects. Co-Authored-By: Claude Fable 5 --- .../org/libremail/data/local/AccountDataMigratorTest.kt | 8 ++++---- .../org/libremail/data/local/AccountDatabaseTest.kt | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/androidTest/kotlin/org/libremail/data/local/AccountDataMigratorTest.kt b/app/src/androidTest/kotlin/org/libremail/data/local/AccountDataMigratorTest.kt index d610200..4eaf071 100644 --- a/app/src/androidTest/kotlin/org/libremail/data/local/AccountDataMigratorTest.kt +++ b/app/src/androidTest/kotlin/org/libremail/data/local/AccountDataMigratorTest.kt @@ -92,7 +92,7 @@ class AccountDataMigratorTest { Room.databaseBuilder(context, AccountDatabase::class.java, accountsName).build() @Test - fun movesEveryAccountTableOutOfAPlaintextCache() = runBlocking { + fun movesEveryAccountTableOutOfAPlaintextCache() = runBlocking { seedVersion14Cache() AccountDataMigrator.copyAccountTables(cacheFile, cachePassphrase = "", accountsFile = accountsFile) @@ -121,7 +121,7 @@ class AccountDataMigratorTest { } @Test - fun movesAccountsOutOfAnEncryptedCache() = runBlocking { + fun movesAccountsOutOfAnEncryptedCache() = runBlocking { seedVersion14Cache() // Turn the cache into the SQLCipher form an app-lock + encrypted-cache user has on disk. DatabaseEncryption.ensureEncrypted(cacheFile, passphrase) @@ -141,7 +141,7 @@ class AccountDataMigratorTest { } @Test - fun reRunningTheCopyIsIdempotentAndKeepsLaterEdits() = runBlocking { + fun reRunningTheCopyIsIdempotentAndKeepsLaterEdits() = runBlocking { seedVersion14Cache() AccountDataMigrator.copyAccountTables(cacheFile, cachePassphrase = "", accountsFile = accountsFile) @@ -167,7 +167,7 @@ class AccountDataMigratorTest { } @Test - fun accountsAndCredentialsSurviveACacheWipe() = runBlocking { + fun accountsAndCredentialsSurviveACacheWipe() = runBlocking { seedVersion14Cache() AccountDataMigrator.copyAccountTables(cacheFile, cachePassphrase = "", accountsFile = accountsFile) diff --git a/app/src/androidTest/kotlin/org/libremail/data/local/AccountDatabaseTest.kt b/app/src/androidTest/kotlin/org/libremail/data/local/AccountDatabaseTest.kt index 8ddae89..c8131c5 100644 --- a/app/src/androidTest/kotlin/org/libremail/data/local/AccountDatabaseTest.kt +++ b/app/src/androidTest/kotlin/org/libremail/data/local/AccountDatabaseTest.kt @@ -49,7 +49,7 @@ class AccountDatabaseTest { ) @Test - fun credentialRoundTripsAndIsIndependentOfTheAccountRow() = runBlocking { + fun credentialRoundTripsAndIsIndependentOfTheAccountRow() = runBlocking { db.accountDao().upsert(account()) db.credentialDao().upsert(CredentialEntity("acct", "sealed-secret")) @@ -57,7 +57,7 @@ class AccountDatabaseTest { } @Test - fun accountSettingsRoundTripAndCascadeWithTheirAccount() = runBlocking { + fun accountSettingsRoundTripAndCascadeWithTheirAccount() = runBlocking { db.accountDao().upsert(account()) db.accountSettingsDao().upsert( AccountSettingsEntity("acct", signature = "Hi", signatureEnabled = false, notificationsEnabled = false), @@ -70,7 +70,7 @@ class AccountDatabaseTest { } @Test - fun signaturesCascadeWithTheirAccount() = runBlocking { + fun signaturesCascadeWithTheirAccount() = runBlocking { db.accountDao().upsert(account()) db.signatureDao().upsert(SignatureEntity("sig-1", "acct", "Work", "

Regards

", isDefault = true)) assertEquals(1, db.signatureDao().observeForAccount("acct").first().size)