// The Inbox's one number, over hand-made group summaries. import assert from "node:assert/strict"; import test from "node:test"; import { CALL_GROUPS, headlineNote, inboxHeadline } from "./headline.mjs"; import { GROUP_IDS } from "./groups.mjs"; const g = (id, cards, decisions, hidden = 0) => ({ id, cards: Array.from({ length: cards }, () => ({})), decisions, hidden }); test("calls are the cards of the five call groups; ready, quiet and hidden are said apart", () => { const h = inboxHeadline([ g("your-call", 1, 1), g("review", 2, 4), g("blocking", 1, 35, 483), g("notes", 1, 14), g("open", 2, 70), g("ready-to-finish", 3, 3, 1), g("quiet", 40, 126, 2), ]); assert.deepEqual(h, { calls: 7, rows: 124, ready: 3, quiet: 126, hidden: 486 }); assert.equal(headlineNote(h), "124 rows · 3 pieces ready to finish · 126 quiet · 486 hidden"); }); test("nothing waiting is zero, and the note keeps its rows and quiet", () => { const h = inboxHeadline(GROUP_IDS.map((id) => g(id, 0, 0))); assert.equal(h.calls, 0); assert.equal(headlineNote(h), "0 rows · 0 quiet"); }); test("the call groups are the groups before Ready to finish, in order", () => { assert.deepEqual(CALL_GROUPS, GROUP_IDS.slice(0, GROUP_IDS.indexOf("ready-to-finish"))); });