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

timelineMinimapItems.test.ts

48 lines1.6 KB

1import { describe, expect, it } from "vite-plus/test";
2import { MessageId } from "@t3tools/contracts";
3import { ATTACHMENT_ONLY_BOOTSTRAP_PROMPT } from "@t3tools/shared/composerContextReferences";
4​
5import { deriveTimelineMinimapItems, resolveTimelineMinimapPreview } from "./timelineMinimapItems";
6​
7describe("deriveTimelineMinimapItems", () => {
8 it.each(["", "Ultrathink:\n"])(
9 "omits bootstrap text from the minimap label and tooltip (%j)",
10 (prefix) => {
11 const at = "2026-10-01T00:00:00Z";
12 const items = deriveTimelineMinimapItems([
13 {
14 kind: "message",
15 id: "image-only",
16 createdAt: at,
17 showAssistantMeta: false,
18 showAssistantCopyButton: false,
19 assistantCopyStreaming: false,
20 message: {
21 id: MessageId.make("image-only"),
22 role: "user",
23 text: prefix + ATTACHMENT_ONLY_BOOTSTRAP_PROMPT,
24 runId: null,
25 streaming: false,
26 createdAt: at,
27 updatedAt: at,
28 },
29 },
30 ]);
31 expect(items).toEqual([{ id: "image-only", rowIndex: 0, userText: "", assistantText: null }]);
32 expect(resolveTimelineMinimapPreview(items[0]!)?.userText).toBeNull();
33 },
34 );
35});
36​
37describe("resolveTimelineMinimapPreview", () => {
38 it("previews a thread autolink as prose, not its URL", () => {
39 const preview = resolveTimelineMinimapPreview({
40 id: "turn-1",
41 rowIndex: 0,
42 userText: null,
43 assistantText:
44 "Started <t3-thread://v2/env-1/thread-1> and [Fix CI](t3-thread://v2/env-1/t2).",
45 });
46 expect(preview?.assistantText).toBe("Started a thread and Fix CI.");
47 });
48});