Fire now was disabled on a paused schedule because the controller fires nothing while it is paused. It is enabled now and, after a confirmation, sends the schedule's message to its agents through the broadcast route, leaving the schedule paused with its start unchanged. A toast says who got it, and the error banner names the agents that did not.
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
// 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",
|
|
);
|
|
});
|