// The body of a schedule's "fire now". Run by `npm test`. import assert from "node:assert/strict"; import { test } from "node:test"; import { fireNowBody, pausedFireOutcome, } from "../src/pages/schedules/ScheduleTypes.ts"; test("fire now moves the start to the current second", () => { assert.deepEqual(fireNowBody(1_700_000_123_456), { anchor_unix: 1_700_000_123, }); }); test("fire now sends nothing but the start", () => { assert.deepEqual(Object.keys(fireNowBody(0)), ["anchor_unix"]); }); test("a paused schedule's send says who got it", () => { assert.deepEqual( pausedFireOutcome("nightly", [{ agent: "iris", sent: true }]), { ok: true, message: "sent nightly to iris" }, ); assert.deepEqual( pausedFireOutcome("nightly", [ { agent: "iris", sent: true }, { agent: "coder", sent: true }, ]), { ok: true, message: "sent nightly to 2 agents" }, ); }); test("a paused schedule's send names the agents that did not get it", () => { const out = pausedFireOutcome("nightly", [ { agent: "iris", sent: true }, { agent: "coder", sent: false, reason: "not running" }, { agent: "gui", sent: false }, ]); assert.equal(out.ok, false); assert.equal( out.message, "nightly did not reach 2 of 3: coder (not running), gui", ); });