Add browser best match option
This commit is contained in:
@@ -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"]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user