Update Android tests (#1013)

This commit is contained in:
Leendert de Borst
2025-07-22 18:47:05 +02:00
committed by Leendert de Borst
parent cec6e7c303
commit dfb8c86366
2 changed files with 10 additions and 4 deletions

View File

@@ -94,12 +94,17 @@ object CredentialMatcher {
}
}
// 4. Domain key match against notes only (since name is already checked in step 3)
// 4. Domain key match against service name, URL, and notes
matches += credentials.filter { cred ->
cred.notes?.lowercase()?.contains(domainKey) == true
val nameMatches = cred.service.name?.trim()?.lowercase()?.contains(domainKey) == true
val urlMatches = cred.service.url?.trim()?.lowercase()?.contains(domainKey) == true
val notesMatches = cred.notes?.lowercase()?.contains(domainKey) == true
nameMatches || urlMatches || notesMatches
}
return matches
// Deduplicate matches based on credential ID to avoid duplicates from different matching strategies
return matches.distinctBy { it.id }
}
/**

View File

@@ -58,8 +58,9 @@ class AutofillTest {
"www.coolblue.nl",
)
assertEquals(1, matches.size)
assertEquals(2, matches.size)
assertEquals("Coolblue", matches[0].service.name)
assertEquals("Coolblue App", matches[1].service.name)
}
@Test