Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Update autofill filter tests for mobile app (#1142)

Leendert de Borst0f8e1f7e15d1
diff --git a/apps/mobile-app/android/app/src/test/java/net/aliasvault/app/nativevaultmanager/AutofillTest.kt b/apps/mobile-app/android/app/src/test/java/net/aliasvault/app/nativevaultmanager/AutofillTest.kt
index 351ab96b2..7430828f5 100644
--- a/apps/mobile-app/android/app/src/test/java/net/aliasvault/app/nativevaultmanager/AutofillTest.kt
+++ b/apps/mobile-app/android/app/src/test/java/net/aliasvault/app/nativevaultmanager/AutofillTest.kt
@@ -270,6 +270,18 @@ class AutofillTest {
assertTrue(matches.isEmpty())
}
+ // [#18] - Ensure only full words are matched
+ @Test
+ fun testOnlyFullWordsMatch() {
+ val matches = CredentialMatcher.filterCredentialsByAppInfo(
+ testCredentials,
+ "Title | Express Yourself | Description",
+ )
+
+ // The string above should not match "AliExpress" service name
+ assertTrue(matches.isEmpty())
+ }
+
/**
* Creates the shared test credential dataset used across all platforms.
* This ensures consistent testing across Browser Extension, iOS, and Android.
@@ -287,6 +299,7 @@ class AutofillTest {
createTestCredential("Subdomain Example", "https://app.example.com", "[email protected]"),
createTestCredential("Title Only newyorktimes", "", ""),
createTestCredential("Bank Account", "https://secure-bank.com", "[email protected]"),
+ createTestCredential("AliExpress", "https://aliexpress.com", "[email protected]"),
)
}
diff --git a/apps/mobile-app/ios/VaultUITests/CredentialFilterTests.swift b/apps/mobile-app/ios/VaultUITests/CredentialFilterTests.swift
index b15c101fd..e01289f0d 100644
--- a/apps/mobile-app/ios/VaultUITests/CredentialFilterTests.swift
+++ b/apps/mobile-app/ios/VaultUITests/CredentialFilterTests.swift
@@ -133,7 +133,7 @@ final class CredentialFilterTests: XCTestCase {
// [#12] - Priority ordering
func testPriorityOrdering() {
let matches = CredentialFilter.filterCredentials(testCredentials, searchText: "coolblue.nl")
-
+
XCTAssertEqual(matches.count, 1)
XCTAssertEqual(matches.first?.service.name, "Coolblue")
}
@@ -174,6 +174,12 @@ final class CredentialFilterTests: XCTestCase {
XCTAssertTrue(matches.isEmpty)
}
+ // [#18] - Ensure only full words are matched
+ func testOnlyFullWordsMatch() {
+ let matches = CredentialFilter.filterCredentials(testCredentials, searchText: "Title | Express Yourself | Description")
+ XCTAssertTrue(matches.isEmpty)
+ }
+
// MARK: - Shared Test Data
/**
@@ -193,6 +199,7 @@ final class CredentialFilterTests: XCTestCase {
createTestCredential(serviceName: "Subdomain Example", serviceUrl: "https://app.example.com", username: "[email protected]"),
createTestCredential(serviceName: "Title Only newyorktimes", serviceUrl: "", username: ""),
createTestCredential(serviceName: "Bank Account", serviceUrl: "https://secure-bank.com", username: "[email protected]"),
+ createTestCredential(serviceName: "AliExpress", serviceUrl: "https://aliexpress.com", username: "[email protected]"),
]
}