Skip to content

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

Add test identifiers for easier cross-platform maintenance (#1120)

Leendert de Borst48c5a5e38ad7
diff --git a/apps/browser-extension/src/entrypoints/contentScript/__tests__/Filter.test.ts b/apps/browser-extension/src/entrypoints/contentScript/__tests__/Filter.test.ts
index a836a1618..910bb6148 100644
--- a/apps/browser-extension/src/entrypoints/contentScript/__tests__/Filter.test.ts
+++ b/apps/browser-extension/src/entrypoints/contentScript/__tests__/Filter.test.ts
@@ -12,6 +12,7 @@ describe('Filter - Credential URL Matching', () => {
testCredentials = createSharedTestCredentials();
});
+ // [#1] - Exact URL match
it('should match exact URL', () => {
const matches = filterCredentials(
testCredentials,
@@ -23,6 +24,7 @@ describe('Filter - Credential URL Matching', () => {
expect(matches[0].ServiceName).toBe('Coolblue');
});
+ // [#2] - Base URL with path match
it('should match base URL with path', () => {
const matches = filterCredentials(
testCredentials,
@@ -34,6 +36,7 @@ describe('Filter - Credential URL Matching', () => {
expect(matches[0].ServiceName).toBe('Gmail');
});
+ // [#3] - Root domain with subdomain match
it('should match root domain with subdomain', () => {
const matches = filterCredentials(
testCredentials,
@@ -45,6 +48,7 @@ describe('Filter - Credential URL Matching', () => {
expect(matches[0].ServiceName).toBe('Google');
});
+ // [#4] - No matches for non-existent domain
it('should return empty array for no matches', () => {
const matches = filterCredentials(
testCredentials,
@@ -55,7 +59,7 @@ describe('Filter - Credential URL Matching', () => {
expect(matches).toHaveLength(0);
});
- // New comprehensive test cases
+ // [#5] - Partial URL stored matches full URL search
it('should match partial URL with full URL - dumpert.nl case', () => {
// Test case: stored URL is "dumpert.nl", search with full URL
const matches = filterCredentials(
@@ -68,6 +72,7 @@ describe('Filter - Credential URL Matching', () => {
expect(matches[0].ServiceName).toBe('Dumpert');
});
+ // [#6] - Full URL stored matches partial URL search
it('should match full URL with partial URL', () => {
// Test case: stored URL is full, search with partial
const matches = filterCredentials(
@@ -80,6 +85,7 @@ describe('Filter - Credential URL Matching', () => {
expect(matches[0].ServiceName).toBe('Coolblue');
});
+ // [#7] - Protocol variations (http/https/none) match
it('should handle protocol variations correctly', () => {
// Test that http and https variations match
const httpsMatches = filterCredentials(
@@ -106,6 +112,7 @@ describe('Filter - Credential URL Matching', () => {
expect(noProtocolMatches[0].ServiceName).toBe('GitHub');
});
+ // [#8] - WWW prefix variations match
it('should handle www variations correctly', () => {
// Test that www variations match
const withWww = filterCredentials(
@@ -125,6 +132,7 @@ describe('Filter - Credential URL Matching', () => {
expect(withoutWww[0].ServiceName).toBe('Dumpert');
});
+ // [#9] - Subdomain matching
it('should handle subdomain matching', () => {
// Test subdomain matching
const appSubdomain = filterCredentials(
@@ -151,6 +159,7 @@ describe('Filter - Credential URL Matching', () => {
expect(noSubdomain[0].ServiceName).toBe('Subdomain Example');
});
+ // [#10] - Paths and query strings ignored
it('should ignore paths and query strings', () => {
// Test that paths and query strings are ignored
const withPath = filterCredentials(
@@ -177,6 +186,7 @@ describe('Filter - Credential URL Matching', () => {
expect(withFragment[0].ServiceName).toBe('Gmail');
});
+ // [#11] - Complex URL variations
it('should handle complex URL variations', () => {
// Test complex URL matching scenario
const complexUrl = filterCredentials(
@@ -189,6 +199,7 @@ describe('Filter - Credential URL Matching', () => {
expect(complexUrl[0].ServiceName).toBe('Coolblue');
});
+ // [#12] - Priority ordering (exact over partial)
it('should prioritize exact matches over partial matches', () => {
// Add a credential with exact domain match to test priority
const credentialsWithExact = [
@@ -212,6 +223,7 @@ describe('Filter - Credential URL Matching', () => {
expect(matches[0].ServiceName).toBe('Exact Match');
});
+ // [#13] - Title-only matching
it('should match title only', () => {
const matches = filterCredentials(
testCredentials,
diff --git a/apps/mobile-app/ios/VaultUITests/CredentialFilterTests.swift b/apps/mobile-app/ios/VaultUITests/CredentialFilterTests.swift
index 61aae1709..73fdee79c 100644
--- a/apps/mobile-app/ios/VaultUITests/CredentialFilterTests.swift
+++ b/apps/mobile-app/ios/VaultUITests/CredentialFilterTests.swift
@@ -17,6 +17,7 @@ final class CredentialFilterTests: XCTestCase {
super.tearDown()
}
+ // [#1] - Exact URL match
func testExactUrlMatch() {
let matches = filterCredentials(testCredentials, searchText: "www.coolblue.nl")
@@ -24,6 +25,7 @@ final class CredentialFilterTests: XCTestCase {
XCTAssertEqual(matches.first?.service.name, "Coolblue")
}
+ // [#2] - Base URL with path match
func testBaseUrlMatch() {
let matches = filterCredentials(testCredentials, searchText: "https://gmail.com/signin")
@@ -31,6 +33,7 @@ final class CredentialFilterTests: XCTestCase {
XCTAssertEqual(matches.first?.service.name, "Gmail")
}
+ // [#3] - Root domain with subdomain match
func testRootDomainMatch() {
let matches = filterCredentials(testCredentials, searchText: "https://mail.google.com")
@@ -38,6 +41,7 @@ final class CredentialFilterTests: XCTestCase {
XCTAssertEqual(matches.first?.service.name, "Google")
}
+ // [#4] - No matches for non-existent domain
func testNoMatches() {
let matches = filterCredentials(testCredentials, searchText: "https://nonexistent.com")
@@ -45,6 +49,7 @@ final class CredentialFilterTests: XCTestCase {
}
// New comprehensive test cases
+ // [#5] - Partial URL stored matches full URL search
func testPartialUrlMatchWithFullUrl() {
// Test case: stored URL is "dumpert.nl", search with full URL
let matches = filterCredentials(testCredentials, searchText: "https://www.dumpert.nl")
@@ -53,6 +58,7 @@ final class CredentialFilterTests: XCTestCase {
XCTAssertEqual(matches.first?.service.name, "Dumpert")
}
+ // [#6] - Full URL stored matches partial URL search
func testFullUrlMatchWithPartialUrl() {
// Test case: stored URL is full, search with partial
let matches = filterCredentials(testCredentials, searchText: "coolblue.nl")
@@ -61,6 +67,7 @@ final class CredentialFilterTests: XCTestCase {
XCTAssertTrue(matches.contains { $0.service.name == "Coolblue" })
}
+ // [#7] - Protocol variations (http/https/none) match
func testProtocolVariations() {
// Test that http and https variations match
let httpsMatches = filterCredentials(testCredentials, searchText: "https://github.com")
@@ -75,6 +82,7 @@ final class CredentialFilterTests: XCTestCase {
XCTAssertEqual(noProtocolMatches.first?.service.name, "GitHub")
}
+ // [#8] - WWW prefix variations match
func testWwwVariations() {
// Test that www variations match
let withWww = filterCredentials(testCredentials, searchText: "www.dumpert.nl")
@@ -86,6 +94,7 @@ final class CredentialFilterTests: XCTestCase {
XCTAssertEqual(withoutWww.first?.service.name, "Dumpert")
}
+ // [#9] - Subdomain matching
func testSubdomainMatching() {
// Test subdomain matching
let appSubdomain = filterCredentials(testCredentials, searchText: "https://app.example.com")
@@ -100,6 +109,7 @@ final class CredentialFilterTests: XCTestCase {
XCTAssertEqual(noSubdomain.first?.service.name, "Subdomain Example")
}
+ // [#10] - Paths and query strings ignored
func testPathAndQueryIgnored() {
// Test that paths and query strings are ignored
let withPath = filterCredentials(testCredentials, searchText: "https://github.com/user/repo")
@@ -114,6 +124,7 @@ final class CredentialFilterTests: XCTestCase {
XCTAssertEqual(withFragment.first?.service.name, "Gmail")
}
+ // [#11] - Complex URL variations
func testComplexUrlVariations() {
// Test complex URL matching scenario
let matches = filterCredentials(testCredentials, searchText: "https://www.coolblue.nl/product/12345?ref=google")
@@ -122,6 +133,7 @@ final class CredentialFilterTests: XCTestCase {
XCTAssertTrue(matches.contains { $0.service.name == "Coolblue" })
}
+ // [#13] - Title-only matching
func testTitleOnlyMatching() {
// Test service name matching when no URL is available
let matches = filterCredentials(testCredentials, searchText: "newyorktimes")