Modern Apps git

← Modern-Apps.git

passwords: fix KdbxSyncEngineTest syntax error from 94e0783d4

Commit
97e0a8138a132541f9d4c1395184854a88c66ca1
Author
Vayun Mathur <[email protected]>
When
2026-11-07 02:46 UTC (29 days ago)
Parents
3cfae06
Commit 94e0783d4 deleted the body of
firstSyncAdoptsMatchingVaultEntriesInsteadOfDuplicating while
inserting new tests after its header, leaving a dangling
@Test header and a missing closing brace that prevented
:passwords unit tests from compiling at all.

KdbxSyncEngine.adoptUnidentified still adopts the sync
identity of a local row for unidentified foreign entries
matched by EntryMapper.contentKey, so restore the pre-
94e0783d4 test body unchanged: it asserts the local row
keeps its local-1 syncId, no duplicate is created, and the
remote entry gains the local-1 syncId.

Verified: gslot ./gradlew :passwords:testDevUnitTest
--tests com.vayunmathur.passwords.sync.KdbxSyncEngineTest
passes.

(cherry picked from commit 6d4a77221aba4286ced7e2f932f17c7e4b289a85)

Diff

passwords/src/test/java/com/vayunmathur/passwords/sync/KdbxSyncEngineTest.kt
diff --git a/passwords/src/test/java/com/vayunmathur/passwords/sync/KdbxSyncEngineTest.kt b/passwords/src/test/java/com/vayunmathur/passwords/sync/KdbxSyncEngineTest.ktindex b66c31936a..ed62d935cb 100644--- a/passwords/src/test/java/com/vayunmathur/passwords/sync/KdbxSyncEngineTest.kt+++ b/passwords/src/test/java/com/vayunmathur/passwords/sync/KdbxSyncEngineTest.kt@@ -112,6 +112,19 @@ class KdbxSyncEngineTest {      @Test fun firstSyncAdoptsMatchingVaultEntriesInsteadOfDuplicating() = runBlocking {         val local = password(1, "GitHub", "octocat", "p", syncId = "local-1", updatedAt = 1000)+        // An entry written by KeePassXC: same credential, but no sync identity.+        val foreign = fields(local) - EntryMapper.FIELD_SYNC_ID - EntryMapper.FIELD_MODIFIED+        val harness = Harness(passwords = listOf(local), remote = listOf(foreign))++        harness.sync()++        assertEquals(1, harness.pwDao.store.size)+        assertEquals("local-1", harness.pwDao.store.single().syncId)+        val remote = harness.remoteEntries()+        assertEquals(1, remote.size)+        assertEquals("local-1", remote.single()[EntryMapper.FIELD_SYNC_ID])+    }+     @Test fun unmatchedForeignEntryIsPulledAsNew() = runBlocking {         val harness = Harness(remote = listOf(mapOf("Title" to "Foreign", "UserName" to "x", "Password" to "y")))