| ... | ... | @@ -478,6 +478,49 @@ describe("threadRuntimeCanArchive", () => { |
| 478 | 478 | }); |
| 479 | 479 | |
| 480 | 480 | describe("presentPendingBackgroundWork", () => { |
| 481 | it.each(["Subagent:", "Subagent: "])( |
| 482 | "falls back to the subagent noun when %s has no display name", |
| 483 | (description) => { |
| 484 | const presentation = presentPendingBackgroundWork([ |
| 485 | { taskId: "unnamed", kind: "subagent", description }, |
| 486 | ]); |
| 487 | |
| 488 | expect(presentation?.title).toBe("Waiting on a subagent"); |
| 489 | expect(presentation?.items[0]?.label).toBe("subagent"); |
| 490 | }, |
| 491 | ); |
| 492 | |
| 493 | it.each([ |
| 494 | "/root/luna_window_properties", |
| 495 | "Subagent: /root/luna_window_properties", |
| 496 | "/root/parent/luna_window_properties", |
| 497 | ])("uses the subagent display name for %s", (description) => { |
| 498 | const childThreadId = ThreadId.make("thread:luna"); |
| 499 | const presentation = presentPendingBackgroundWork([ |
| 500 | { taskId: "luna", kind: "subagent", description, childThreadId }, |
| 501 | ]); |
| 502 | |
| 503 | expect(presentation).toEqual({ |
| 504 | title: "Waiting on subagent Luna Window Properties", |
| 505 | items: [{ taskId: "luna", kind: "subagent", label: "Luna Window Properties", childThreadId }], |
| 506 | }); |
| 507 | }); |
| 508 | |
| 509 | it("formats subagent names in a mixed roster and preserves command descriptions", () => { |
| 510 | const presentation = presentPendingBackgroundWork([ |
| 511 | { taskId: "cmd", kind: "command", description: "/root/run_tests" }, |
| 512 | { taskId: "luna", kind: "subagent", description: "/root/luna_window_properties" }, |
| 513 | { taskId: "review", kind: "subagent", description: "Review src/math.ts" }, |
| 514 | ]); |
| 515 | |
| 516 | expect(presentation?.title).toBe("Waiting on 2 subagents and 1 command"); |
| 517 | expect(presentation?.items.map((item) => item.label)).toEqual([ |
| 518 | "Luna Window Properties", |
| 519 | "Review src/math.ts", |
| 520 | "/root/run_tests", |
| 521 | ]); |
| 522 | }); |
| 523 | |
| 481 | 524 | it("names a single piece of work by kind", () => { |
| 482 | 525 | expect( |
| 483 | 526 | presentPendingBackgroundWork([ |