18 lines · 1.1 KB · TypeScriptRaw
import { expect, it } from "vitest";import { dealtActs } from "../gen-cards/dealt-acts";// RULE: Only acts dealt as cards owe card labels and objects; field-sheet and picker commands are slips and must not be constrained by the narrower card label.it("selects page, strip and section acts without selecting a field sheet's command", () => { const commands = ["main", "more", "away", "card", "strip", "section", "sheet", "picker"].map((id) => ({ id })); const held = dealtActs(commands, { acts: { main: "main", more: ["more"], away: "away" }, cards: [{ act: "card" }], strip: [{ act: "strip" }], }, [{ commands: ["section"] }]); expect(held.map((command) => command.id)).toEqual(["main", "more", "away", "card", "strip", "section"]);});// RULE: A command's sheet key owns a slip on that field card; the page-card check skips it even if stale page placement still names the command.it("does not measure sheet-owned slips as cards", () => { const commands = [{ id: "allow", sheet: "notify" }, { id: "sync" }]; expect(dealtActs(commands, { acts: { main: "sync", more: ["allow"], away: null } }, []).map((command) => command.id)).toEqual(["sync"]);});