Open History to see the last commit
1import type { OrchestrationV2TurnItemStatus } from "@t3tools/contracts";
2import { describe, expect, it } from "vite-plus/test";
3import { subagentGroupSummary } from "./subagentDisplay.js";
4
5describe("subagentGroupSummary", () => {
6 it.each(["pending", "running", "waiting"] as const)(
7 "keeps a mixed group live while a member is %s",
8 (status) => {
9 expect(subagentGroupSummary([{ status: "completed" }, { status }])).toEqual({
10 label: "Kicked off 2 subagents",
11 active: true,
12 failed: false,
13 });
14 },
15 );
16
17 it("settles the label without disguising a failed member as success", () => {
18 const statuses: OrchestrationV2TurnItemStatus[] = [
19 "completed",
20 "failed",
21 "cancelled",
22 "interrupted",
23 ];
24 expect(subagentGroupSummary(statuses.map((status) => ({ status })))).toEqual({
25 label: "Ran 4 subagents",
26 active: false,
27 failed: true,
28 });
29 });
30
31 it("uses a singular label for one idle member", () => {
32 expect(subagentGroupSummary([{ status: "idle" }])).toEqual({
33 label: "Ran 1 subagent",
34 active: false,
35 failed: false,
36 });
37 });
38});