fix(test): correct AccountDataMigratorTest assertions

Two on-device assertion failures (green on JVM compile, red on the
emulator):

- migratorDdlMatchesExportedAccountDatabaseSchema built its expected DDL
  by substituting the schema's `${TABLE_NAME}` placeholder with a
  backtick-wrapped name, but the exported createSql already wraps the
  placeholder in backticks — producing a double-backticked identifier
  that never matched the (correct, single-backticked) migrator DDL.
  Substitute the bare name so the guard compares like-for-like.
- movesEveryAccountTableOutOfAPlaintextCache asserted signatureEnabled
  was false, but the seed row sets it to 1 (true). Assert the seeded
  values for both booleans so a true and a false each round-trip.

The production migrator DDL and drop logic were already correct; only
the tests were wrong.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 08:25:26 -05:00
co-authored by Claude Fable 5
parent d9d50f1903
commit 7529a8fa7d
@@ -110,7 +110,9 @@ class AccountDataMigratorTest {
assertEquals("smtp.example.org", account?.smtp?.host)
assertEquals("sealed-secret", credentialDao().getById("acct")?.encryptedSecret)
val settings = accountSettingsDao().get("acct")
assertEquals(false, settings?.signatureEnabled)
// Seeded signatureEnabled = 1, notificationsEnabled = 0: both booleans must round-trip.
assertEquals(true, settings?.signatureEnabled)
assertEquals(false, settings?.notificationsEnabled)
assertEquals(6, settings?.retentionMonths)
assertNull(settings?.retentionCount)
val signatures = signatureDao().observeForAccount("acct").first()
@@ -198,7 +200,7 @@ class AccountDataMigratorTest {
for (i in 0 until entities.length()) {
val entity = entities.getJSONObject(i)
val table = entity.getString("tableName")
val expectedCreate = entity.getString("createSql").replace("\${TABLE_NAME}", "`$table`")
val expectedCreate = entity.getString("createSql").replace("\${TABLE_NAME}", table)
assertEquals(
"AccountDataMigrator DDL for `$table` must match the exported AccountDatabase schema",
expectedCreate,
@@ -211,7 +213,7 @@ class AccountDataMigratorTest {
if (index.getString("name") == "index_signatures_accountId") {
assertEquals(
"AccountDataMigrator signatures index must match the exported schema",
index.getString("createSql").replace("\${TABLE_NAME}", "`$table`"),
index.getString("createSql").replace("\${TABLE_NAME}", table),
AccountDataMigrator.SIGNATURES_INDEX_SQL,
)
checkedIndex = true