The best way to control Claude Code, Codex and more from any computer or phone

main
ts 29 lines 1.11 KB
Raw
1 import { EnvironmentId, ThreadId } from "@t3tools/contracts";
2 import { threadContextRecord } from "@t3tools/shared/composerContextReferences";
3 import { describe, expect, it } from "vite-plus/test";
4 import { droppedThreadContextRecord } from "./threadContextDrop.logic";
5
6 describe("droppedThreadContextRecord", () => {
7 it.each([null, { title: "Cached title" }])(
8 "uses the search result title even when the sidebar shell is %s",
9 (shell) => {
10 const ref = {
11 environmentId: EnvironmentId.make("remote"),
12 threadId: ThreadId.make("search-result"),
13 title: "Search result",
14 };
15 expect(droppedThreadContextRecord(ref, shell)).toEqual(threadContextRecord(ref, ref.title));
16 },
17 );
18
19 it("uses the sidebar title for a drag without search metadata", () => {
20 const ref = {
21 environmentId: EnvironmentId.make("local"),
22 threadId: ThreadId.make("sidebar-thread"),
23 };
24 expect(droppedThreadContextRecord(ref, { title: "Sidebar thread" })).toEqual(
25 threadContextRecord(ref, "Sidebar thread"),
26 );
27 expect(droppedThreadContextRecord(ref, null)).toBeNull();
28 });
29 });