Open History to see the last commit
1import { describe, expect, it } from "vite-plus/test";
2import type { RuntimeSubagent } from "@t3tools/client-runtime/state/subagentRuntime";
3import { deriveAgentSpawnSummary } from "./agentSpawnSummary";
4
5const agent = (status: RuntimeSubagent["status"]) => ({ kind: "subagent" as const, status });
6
7describe("deriveAgentSpawnSummary", () => {
8 it("does not claim completion when the roster is missing a member", () => {
9 expect(deriveAgentSpawnSummary({ agents: [agent("completed")], agentCount: 2 })).toMatchObject({
10 status: "Status unavailable",
11 tone: "inactive",
12 });
13 });
14
15 it("keeps a workflow active between child launches", () => {
16 expect(
17 deriveAgentSpawnSummary({
18 agents: [agent("completed")],
19 agentCount: 1,
20 coordinatorStatus: "running",
21 }),
22 ).toMatchObject({ live: true, status: "working", tone: "working" });
23 });
24
25 it.each([
26 ["failed", "Workflow failed", "failed"],
27 ["cancelled", "Workflow stopped", "inactive"],
28 ] as const)(
29 "preserves a %s workflow outcome when its children completed",
30 (coordinatorStatus, status, tone) => {
31 expect(
32 deriveAgentSpawnSummary({ agents: [agent("completed")], agentCount: 1, coordinatorStatus }),
33 ).toMatchObject({ live: false, status, tone });
34 },
35 );
36});