Add browser best match option
ci / lint-test (pull_request) Successful in 5m1s
ci / build (pull_request) Successful in 7m28s

This commit is contained in:
Joe Julian
2026-04-25 11:42:43 -07:00
parent 2269944702
commit d1f30f5936
6 changed files with 96 additions and 7 deletions
+20
View File
@@ -69,6 +69,7 @@ test("shouldContinueWatchingState keeps polling locked login pages", () => {
test("default settings include a blank bearer token that can be overridden by harness patching", () => {
assert.equal(background.defaultSettings.bearerToken, "");
assert.equal(background.defaultSettings.bestMatchOnly, false);
});
test("savePlanForObservedLogin prefers updating an exact username match", () => {
@@ -129,3 +130,22 @@ test("savePlanForObservedLogin falls back to saving into the current page group"
url: "https://vault.example.invalid/login"
});
});
test("applyBestMatchOnly keeps only the strongest quality band when enabled", () => {
const filtered = background.applyBestMatchOnly([
{ id: "livingston", title: "Livingston Dell", quality: "exact" },
{ id: "rusty", title: "Rusty Ryan", quality: "host" },
{ id: "linus", title: "Linus Caldwell", quality: "scheme" }
], true);
assert.deepEqual(filtered.map((match) => match.id), ["livingston"]);
});
test("applyBestMatchOnly preserves all matches when disabled", () => {
const filtered = background.applyBestMatchOnly([
{ id: "livingston", title: "Livingston Dell", quality: "exact" },
{ id: "rusty", title: "Rusty Ryan", quality: "host" }
], false);
assert.deepEqual(filtered.map((match) => match.id), ["livingston", "rusty"]);
});