Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

orchestrationV2Timeline.test.ts

46 lines1.5 KB

1import { NodeId, RunId } from "@t3tools/contracts";
2import { describe, expect, it } from "vite-plus/test";
3​
4import { isOrchestrationV2TurnItemVisible } from "./orchestrationV2Timeline.ts";
5​
6const runId = RunId.make("run:timeline-visibility");
7const nodeId = NodeId.make("node:timeline-visibility");
8​
9describe("isOrchestrationV2TurnItemVisible", () => {
10 it("hides interruption results from superseded attempts", () => {
11 expect(
12 isOrchestrationV2TurnItemVisible({
13 item: { type: "run_interrupt_result", runId, nodeId },
14 runs: [{ id: runId, status: "running" }],
15 attempts: [{ runId, rootNodeId: nodeId, status: "superseded" }],
16 }),
17 ).toBe(false);
18 });
19​
20 it("keeps interruption results from terminal attempts", () => {
21 expect(
22 isOrchestrationV2TurnItemVisible({
23 item: { type: "run_interrupt_result", runId, nodeId },
24 runs: [{ id: runId, status: "interrupted" }],
25 attempts: [{ runId, rootNodeId: nodeId, status: "interrupted" }],
26 }),
27 ).toBe(true);
28 });
29​
30 it("does not hide an interruption because another attempt was superseded", () => {
31 expect(
32 isOrchestrationV2TurnItemVisible({
33 item: { type: "run_interrupt_result", runId, nodeId },
34 runs: [{ id: runId, status: "interrupted" }],
35 attempts: [
36 {
37 runId,
38 rootNodeId: NodeId.make("node:timeline-visibility:older"),
39 status: "superseded",
40 },
41 { runId, rootNodeId: nodeId, status: "interrupted" },
42 ],
43 }),
44 ).toBe(true);
45 });
46});