Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: let a paused schedule's fire now send its message as a broadcast

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.
This commit is contained in:
iris 2026-11-25 18:19:11 +01:00
commit 09de25b0ed

View file

@ -1,7 +1,10 @@
// 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 } from "../src/pages/schedules/ScheduleTypes.ts";
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), {
@ -12,3 +15,30 @@ test("fire now moves the start to the current second", () => {
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",
);
});