27 lines
1.3 KiB
JavaScript
27 lines
1.3 KiB
JavaScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { canCancel } from "../src/actions.js";
|
|
import { runStatusLabel } from "../src/runs.js";
|
|
import { foldRunEvent, foldRunEventDetail } from "../src/runEvents.js";
|
|
|
|
test("stop intent stays nonterminal, disables Stop, and folds into live rows", () => {
|
|
const run = { id: 4, status: "running", executing: true, steps: [] };
|
|
const frame = { run_id: 4, status: "running", cancel_requested: true };
|
|
const updated = foldRunEvent([run], frame).runs[0];
|
|
assert.equal(updated.status, "running");
|
|
assert.equal(updated.executing, true);
|
|
assert.equal(canCancel(updated), false);
|
|
assert.match(runStatusLabel(updated), /Stopping/);
|
|
assert.equal(foldRunEventDetail(run, frame).cancel_requested, true);
|
|
});
|
|
|
|
test("cleanup uncertainty remains visible until a terminal observation", () => {
|
|
const run = { id: 4, status: "running", executing: true };
|
|
const pending = foldRunEvent([run], { run_id: 4, cleanup_unconfirmed: true }).runs[0];
|
|
assert.equal(canCancel(pending), false);
|
|
assert.match(runStatusLabel(pending), /Cleanup unconfirmed.*workspace reserved/);
|
|
const terminal = foldRunEvent([pending], { run_id: 4, status: "canceled" }).runs[0];
|
|
assert.equal(terminal.executing, false);
|
|
assert.equal(runStatusLabel(terminal), "canceled");
|
|
});
|