commit 90270f6ea451f4fb41ce64bcb8c48ac7715b09f1
parent befc5f69b22ace8f3853be3a4e842614a44698f6
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 6 Nov 2026 21:07:38 -0500
umtool: the shelf goal tests read the board: the fan blocks are shelfGoalStates', and its headline is the closest in force, not the newest
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 21 insertions(+), 15 deletions(-)
diff --git a/umtool/report-to-video/shelf.test.mjs b/umtool/report-to-video/shelf.test.mjs
@@ -10,7 +10,8 @@ import path from "node:path";
import test from "node:test";
import { fileURLToPath } from "node:url";
-import { dietHtml, goalsHtml, tagWords, tagWordSize } from "./chrome-measure-extras.mjs";
+import { dietHtml, goalsHtml, shelfGoalStates, tagWords, tagWordSize } from "./chrome-measure-extras.mjs";
+import { goalBoard, goalsAt } from "./measure-goals.mjs";
import { shelfHtml, shelfNoteGeometry } from "./chrome-shelf.mjs";
import { deckGeometry, entryShelfNotes, estimateSchedule, instrumentsGeometry, parseShelfNote, validateChrome } from "./deck.mjs";
import { dietDays, dietStates, goalStates, dietTagsBox, GOALS_SHELF, goalsShelfWidth, measureExtraGeometry, measurePlacements, shelfLayout, streakStates } from "./measure-extras.mjs";
@@ -258,25 +259,30 @@ test("goals on the shelf: the count and the fanned notes, the fan taking the she
assert.match(html, /<div class="gc"><div class="gn" data-k="s0\.c">1<\/div><div class="gl">goal set<\/div><\/div>/);
assert.match(html, /class="note" data-k="s\d+\.n\d+" style="z-index:19"><div class="tape"><\/div><div class="nf"/);
assert.match(html, /<div class="nb"[^>]*><div class="bt">LOSE 100<\/div>/, "an older note shows its words beside the one in front");
- assert.equal(items.length, goalStates(schedule(), r).length);
+ // A block per state of the fan: each goal he sets, and each second the goal board alone changes (shelfGoalStates).
+ assert.equal(items.length, shelfGoalStates(schedule(), goalStates(schedule(), r)).length);
// Off the shelf: the pile in the footage, as it was.
assert.doesNotMatch(goalsHtml(schedule(), renderOf(INSTRUMENTS), { fonts: {} }).html, /class="gc"/);
});
-test("goals on the shelf: the headline goal leads when the state names one (goals.headline), with the ladder's count; else the newest", () => {
+test("goals on the shelf: the dial's goal board orders the fan -- its headline in front, +N more for the others in force", () => {
const r = renderOf(FAN);
const m = clone(MEASURE);
- // The state as the dial-ghosts lane writes it: goals an object with the headline (a goal carrying its row) and those in force.
- const firstGoal = m.events.findIndex((e) => e.kind === "goal" || e.kind === "goalLoss");
+ // Two goals in force at the end, the newer the more ambitious: the closer one leads, not the newest.
const lastGoal = m.events.map((e, i) => [e, i]).filter(([e]) => e.kind === "goal" || e.kind === "goalLoss").at(-1)[1];
- const hl = m.events[firstGoal].row;
- const s = m.state[lastGoal + 1];
- s.goals = { set: Array.isArray(s.goals) ? s.goals : [], headline: { row: hl }, active: [hl, "x", "y"] };
- const states = goalStates(schedule({ measure: m }), r);
- assert.equal(states.at(-1).headline, states[0].top, "the first goal's note heads the last state");
- assert.equal(states.at(-1).active, 3);
- const { html } = goalsHtml(schedule({ measure: m }), r, { fonts: {} });
- assert.match(html, /<div class="mo">\+2 more<\/div>/);
- // Without it, the newest leads, as before.
- assert.equal("headline" in goalStates(schedule(), r).at(-1), false);
+ const t = m.events[lastGoal].t;
+ m.events.splice(lastGoal + 1, 0, { ...m.events[lastGoal], t: t + 0.5, row: "far", kind: "goal", value: 221, display: "221", qualifier: null, deadline: null, due: null, asOf: null, range: undefined });
+ m.state.splice(lastGoal + 2, 0, { ...m.state[lastGoal + 1], t: t + 0.5 });
+ const sched = schedule({ measure: m });
+ const board = goalBoard(m);
+ const end = goalsAt(board, Infinity);
+ assert.ok(end.active.length > 1 && end.headline.row !== "far", "the fixture's last goal is closer than 221");
+ const shelf = shelfGoalStates(sched, goalStates(sched, r));
+ const last = shelf.at(-1);
+ const front = last.notes.find((n) => n.depth === 0);
+ assert.equal(front.key, last.headline, "the board's headline is in front");
+ assert.notEqual(front.key, "221 lb", "not the newest");
+ assert.equal(last.active, end.active.length);
+ const { html } = goalsHtml(sched, r, { fonts: {} });
+ assert.match(html, new RegExp(`<div class="mo">\\+${end.active.length - 1} more</div>`));
});