import { test } from "node:test"; import assert from "node:assert/strict"; import { autoPausedRows } from "./review"; import type { ChannelPriority } from "../lib/channelPriority"; function model( channels: ChannelPriority["channels"], ): ChannelPriority { return { focus: { kind: "none" }, channels }; } test("only auto-paused channels are rows, and they carry where Resume puts them back", () => { const rows = autoPausedRows( model({ zeta: { tier: "paused", autoPaused: { reason: "storage", since: "2026-09-19T04:05:06.000Z", previousTier: "low", }, }, // Paused BY A PERSON. It must not appear: /review is for decisions the // machine took, and offering to "resume" a deliberate pause is how an // operator undoes their own fence by accident. alpha: { tier: "paused" }, beta: { tier: "normal" }, }), ); assert.deepEqual( rows.map((r) => r.slug), ["zeta"], ); assert.equal(rows[0].previousTier, "low"); assert.equal(rows[0].reason, "storage"); assert.match(rows[0].detail, /drive that is not there/); assert.match(rows[0].detail, /2026-09-19/); }); test("the order is the slug order, so an auto-refresh cannot reshuffle the list", () => { const entry = (previousTier: "normal" | "low") => ({ tier: "paused" as const, autoPaused: { reason: "storage" as const, since: "2026-09-19T00:00:00.000Z", previousTier, }, }); const rows = autoPausedRows( model({ zeta: entry("low"), alpha: entry("normal"), mid: entry("normal") }), ); assert.deepEqual( rows.map((r) => r.slug), ["alpha", "mid", "zeta"], ); }); test("an empty document is no rows, not a section full of nothing", () => { assert.deepEqual(autoPausedRows(model({})), []); });