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

Errors.test.ts

39 lines1.3 KB

1import { expect, it } from "@effect/vitest";
2import { ThreadId } from "@t3tools/contracts";
3​
4import {
5 CheckpointRefUnavailableError,
6 CheckpointTurnRangeUnavailableError,
7 CheckpointWorkspacePathMissingError,
8} from "./Errors.ts";
9​
10const threadId = ThreadId.make("thread-1");
11​
12it("derives checkpoint messages from structured context", () => {
13 const range = new CheckpointTurnRangeUnavailableError({
14 operation: "CheckpointDiffQuery.getTurnDiff",
15 threadId,
16 requestedTurnCount: 4,
17 availableTurnCount: 2,
18 });
19 const checkpoint = new CheckpointRefUnavailableError({
20 operation: "CheckpointDiffQuery.getTurnDiff",
21 threadId,
22 turnCount: 2,
23 checkpoint: "to",
24 });
25 const workspace = new CheckpointWorkspacePathMissingError({
26 operation: "CheckpointDiffQuery.getFullThreadDiff",
27 threadId,
28 });
29​
30 expect(range.message).toBe(
31 "Checkpoint unavailable for thread thread-1 turn 4: Turn diff range exceeds current turn count: requested 4, current 2.",
32 );
33 expect(checkpoint.message).toBe(
34 "Checkpoint unavailable for thread thread-1 turn 2: Checkpoint ref is unavailable for turn 2.",
35 );
36 expect(workspace.message).toBe(
37 "Checkpoint invariant violation in CheckpointDiffQuery.getFullThreadDiff: Workspace path missing for thread 'thread-1' when computing full thread diff.",
38 );
39});