fix(test): make instrumented migrator tests return Unit
`@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<Unit>` (the existing DatabaseEncryptionTest idiom) so the
methods are void while keeping the expression body ktlint expects.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -92,7 +92,7 @@ class AccountDataMigratorTest {
|
||||
Room.databaseBuilder(context, AccountDatabase::class.java, accountsName).build()
|
||||
|
||||
@Test
|
||||
fun movesEveryAccountTableOutOfAPlaintextCache() = runBlocking {
|
||||
fun movesEveryAccountTableOutOfAPlaintextCache() = runBlocking<Unit> {
|
||||
seedVersion14Cache()
|
||||
|
||||
AccountDataMigrator.copyAccountTables(cacheFile, cachePassphrase = "", accountsFile = accountsFile)
|
||||
@@ -121,7 +121,7 @@ class AccountDataMigratorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun movesAccountsOutOfAnEncryptedCache() = runBlocking {
|
||||
fun movesAccountsOutOfAnEncryptedCache() = runBlocking<Unit> {
|
||||
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<Unit> {
|
||||
seedVersion14Cache()
|
||||
AccountDataMigrator.copyAccountTables(cacheFile, cachePassphrase = "", accountsFile = accountsFile)
|
||||
|
||||
@@ -167,7 +167,7 @@ class AccountDataMigratorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun accountsAndCredentialsSurviveACacheWipe() = runBlocking {
|
||||
fun accountsAndCredentialsSurviveACacheWipe() = runBlocking<Unit> {
|
||||
seedVersion14Cache()
|
||||
AccountDataMigrator.copyAccountTables(cacheFile, cachePassphrase = "", accountsFile = accountsFile)
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class AccountDatabaseTest {
|
||||
)
|
||||
|
||||
@Test
|
||||
fun credentialRoundTripsAndIsIndependentOfTheAccountRow() = runBlocking {
|
||||
fun credentialRoundTripsAndIsIndependentOfTheAccountRow() = runBlocking<Unit> {
|
||||
db.accountDao().upsert(account())
|
||||
db.credentialDao().upsert(CredentialEntity("acct", "sealed-secret"))
|
||||
|
||||
@@ -57,7 +57,7 @@ class AccountDatabaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun accountSettingsRoundTripAndCascadeWithTheirAccount() = runBlocking {
|
||||
fun accountSettingsRoundTripAndCascadeWithTheirAccount() = runBlocking<Unit> {
|
||||
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<Unit> {
|
||||
db.accountDao().upsert(account())
|
||||
db.signatureDao().upsert(SignatureEntity("sig-1", "acct", "Work", "<p>Regards</p>", isDefault = true))
|
||||
assertEquals(1, db.signatureDao().observeForAccount("acct").first().size)
|
||||
|
||||
Reference in New Issue
Block a user