Add quantitative tasks with checklist controls to the planner
All checks were successful
Validate and deploy Sokko G / validate (push) Successful in 17m38s
Validate and deploy Sokko G / deploy (push) Successful in 9s

This commit is contained in:
Shinuwa 2026-10-24 15:02:33 +02:00
parent 29fcb50fcd
commit c08452d5a4
22 changed files with 434 additions and 33 deletions

View file

@ -40,7 +40,7 @@ function sourceModuleData() {
"source:rngSimulator": { rates: [{ id: "rate", label: "Rare", rate: "5" }] },
"source:combos": { combos: [{ id: "combo", name: "Attaque", inputs: [[{ kind: "button", value: "cross" }]] }] },
"source:planner": {
tasks: [{ id: "parent", title: "Parent", type: "unique" }, { id: "child", title: "Enfant", type: "daily" }],
tasks: [{ id: "parent", title: "Parent", type: "unique", qtyTarget: 5, qtyCurrent: 5, progressAt: 1000 }, { id: "child", title: "Enfant", type: "daily", qtyTarget: 3, qtyCurrent: 1, progressAt: 2000 }],
relations: [{ id: "relation", fromTaskId: "child", toTaskId: "parent" }]
},
"source:calculator": {
@ -104,6 +104,24 @@ test("a v2 individual export round-trips all registered tool types and five spac
const memos = roundTrip.toolbox.modules.find((module) => module.type === "memos");
const planner = roundTrip.toolbox.modules.find((module) => module.type === "taskPlanner");
assert.equal(roundTrip.modules[memos.id].plannerLink, planner.id);
assert.deepEqual(roundTrip.modules[planner.id], payload.modules[planner.id]);
});
test("v2 rejects noncanonical planner quantities before importing any toolbox", async () => {
for (const patch of [{ qtyTarget: 1 }, { qtyTarget: 2.5 }, { qtyCurrent: 99 }, { qtyCurrent: "2" }, { checked: true }, { progressAt: -1 }]) {
const payload = validIndividualPayload();
const planner = payload.toolbox.modules.find((module) => module.type === "taskPlanner");
Object.assign(payload.modules[planner.id].tasks[0], patch);
let writes = 0;
const actions = useToolboxActions({
store: { ready: true, persistToolboxSnapshot: async () => { writes += 1; return true; } },
notify() {},
setConfirmModal() {}
});
assert.throws(() => validateToolboxImportPayload(payload, "single"));
await actions.importToolbox({ text: async () => JSON.stringify(payload) });
assert.equal(writes, 0);
}
});
test("compact empty individual and global v2 exports remain valid", () => {