Link guide cards to checklists and refine Aniimo ability filters
All checks were successful
Deploy Sokko G / deploy (push) Successful in 17s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 17s
This commit is contained in:
parent
b5901b31e3
commit
7b23a8601a
23 changed files with 193 additions and 51 deletions
|
|
@ -94,10 +94,11 @@ test("element AND never borrows elements or roles from the parent or sibling var
|
|||
|
||||
test("ability thresholds remain independent, inclusive and constrained to a single variant", () => {
|
||||
assert.equal(filter({ abilities: { carry: 3, crafting: 2 } }, fixture).length, 0);
|
||||
assert.equal(filter({ abilities: { carry: 3, crafting: 2 }, abilitiesLogic: "or" }, fixture).length, 3);
|
||||
assert.deepEqual(filter({ abilities: { carry: 4, crafting: 2 }, abilitiesLogic: "or" }, fixture).map((v) => v.form), ["water_form", "both_form"]);
|
||||
assert.deepEqual(filter({ abilities: { carry: 3, crafting: 1 } }, fixture).map((v) => v.form), ["both_form"]);
|
||||
assert.equal(filter({ elements: ["rock"], roles: ["heal"], abilitiesLogic: "or", abilities: { carry: 1, crafting: 1 } }, fixture).length, 0);
|
||||
assert.deepEqual(filter({ abilities: { carry: 3 }, abilityExact: true }, fixture).map((v) => v.form), ["rock_form"]);
|
||||
assert.deepEqual(filter({ abilities: { carry: 4 }, abilityExact: true }, fixture).map((v) => v.form), ["both_form"]);
|
||||
assert.equal(filter({ abilities: { carry: 2, crafting: 1 }, abilityExact: true }, fixture).length, 0);
|
||||
assert.equal(filter({ elements: ["rock"], roles: ["heal"], abilities: { carry: 1, crafting: 1 } }, fixture).length, 0);
|
||||
});
|
||||
|
||||
test("grouping preserves order and contains only variants that pass all filters", () => {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Rôle : vérifie les correspondances des guides et la validité des associations de session.
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { aniimoChecklistEntries, matchGuideChecklist, normalizeGuideLabel, validGuideAssociations } from "../website/src/features/games/guideChecklist.js";
|
||||
import { aniimoChecklistEntries, matchGuideChecklist, normalizeGuideLabel, toggleGuideChecklistRows, validGuideAssociations } from "../website/src/features/games/guideChecklist.js";
|
||||
|
||||
const variants = [{ key: "1:base", name: "emberpup", form: "base" }, { key: "1:mountain", name: "emberpup", form: "mountain" }];
|
||||
const entries = aniimoChecklistEntries(variants, { emberpup: "Loufeuteau", base: "Forme de base", mountain: "Montagnes" }, { emberpup: "Emberpup", base: "Basic form", mountain: "Mountain form" });
|
||||
|
|
@ -43,6 +43,21 @@ test("all duplicate lines must reach their own target, including translated alia
|
|||
assert.equal(matchGuideChecklist(entries, {}).count, 0);
|
||||
});
|
||||
|
||||
test("card toggles update every exact matching row to its target or zero", () => {
|
||||
const data = { sections: [{ id: "s1", items: [
|
||||
{ id: "a", label: "Loufeuteau", qtyTarget: 3, qtyCurrent: 1 },
|
||||
{ id: "b", label: "Emberpup", qtyTarget: 2, qtyCurrent: 0 },
|
||||
{ id: "c", label: "Unrelated", qtyCurrent: 1 }
|
||||
] }] };
|
||||
const match = matchGuideChecklist(entries, data);
|
||||
assert.deepEqual(match.rowIds.get("1:base"), ["a", "b"]);
|
||||
const completed = toggleGuideChecklistRows(data, match.rowIds.get("1:base"), true);
|
||||
assert.deepEqual(completed.sections[0].items.map((item) => item.qtyCurrent), [3, 2, 1]);
|
||||
const cleared = toggleGuideChecklistRows(completed, match.rowIds.get("1:base"), false);
|
||||
assert.deepEqual(cleared.sections[0].items.map((item) => item.qtyCurrent), [0, 0, 1]);
|
||||
assert.equal(data.sections[0].items[0].qtyCurrent, 1);
|
||||
});
|
||||
|
||||
test("session associations require the current linked toolbox and an existing checklist", () => {
|
||||
const toolbox = { id: "tb", modules: [{ id: "capture", type: "checklist" }, { id: "notes", type: "notepad" }] };
|
||||
const association = { toolboxId: "tb", moduleId: "capture", hideCompleted: true };
|
||||
|
|
|
|||
|
|
@ -96,6 +96,8 @@ export function validateSiteContent(site) {
|
|||
"guideChecklist.unlink",
|
||||
"guideChecklist.hideCompleted",
|
||||
"guideChecklist.completed",
|
||||
"guideChecklist.checkCard",
|
||||
"guideChecklist.uncheckCard",
|
||||
"aniimo.copyChecklist",
|
||||
"aniimo.copyVariantsChecklist",
|
||||
"aniimo.statsTitle",
|
||||
|
|
@ -118,7 +120,8 @@ export function validateSiteContent(site) {
|
|||
"aniimo.role",
|
||||
"aniimo.abilities",
|
||||
"aniimo.minimum",
|
||||
"aniimo.abilityLevelsHint",
|
||||
"aniimo.exactLevel",
|
||||
"aniimo.levelMode",
|
||||
"aniimo.abilityDisabled",
|
||||
"aniimo.level",
|
||||
"aniimo.match",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue