Open History to see the last commit
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 showAssistantTimestamp: false,
19 showAssistantCopyButton: false,
20 assistantCopyStreaming: false,
21 message: {
22 id: MessageId.make("image-only"),
23 role: "user",
24 text: prefix + ATTACHMENT_ONLY_BOOTSTRAP_PROMPT,
25 runId: null,
26 streaming: false,
27 createdAt: at,
28 updatedAt: at,
29 },
30 },
31 ]);
32 expect(items).toEqual([{ id: "image-only", rowIndex: 0, userText: "", assistantText: null }]);
33 expect(resolveTimelineMinimapPreview(items[0]!)?.userText).toBeNull();
34 },
35 );
36});
37
38describe("resolveTimelineMinimapPreview", () => {
39 it("previews a thread autolink as prose, not its URL", () => {
40 const preview = resolveTimelineMinimapPreview({
41 id: "turn-1",
42 rowIndex: 0,
43 userText: null,
44 assistantText:
45 "Started <t3-thread://v2/env-1/thread-1> and [Fix CI](t3-thread://v2/env-1/t2).",
46 });
47 expect(preview?.assistantText).toBe("Started a thread and Fix CI.");
48 });
49});