The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import { |
| 2 | formatComposerContextReference, |
| 3 | toComposerContextId, |
| 4 | } from "@t3tools/shared/composerContextReferences"; |
| 5 | import { describe, expect, it } from "vite-plus/test"; |
| 6 | |
| 7 | import { stashEntrySnippet } from "./ComposerStashMenu"; |
| 8 | |
| 9 | const entry = (prompt: string) => ({ |
| 10 | id: "stash-1", |
| 11 | createdAt: "2026-10-01T00:00:00.000Z", |
| 12 | prompt, |
| 13 | attachments: [], |
| 14 | droppedImageNames: [], |
| 15 | }); |
| 16 | |
| 17 | describe("stashEntrySnippet", () => { |
| 18 | it("cuts a long prompt on a whole character", () => { |
| 19 | expect(stashEntrySnippet(entry(`${"a".repeat(89)}😀 and more`))).toBe(`${"a".repeat(89)}…`); |
| 20 | expect(stashEntrySnippet(entry(`${"a".repeat(88)}😀 and more`))).toBe(`${"a".repeat(88)}😀…`); |
| 21 | }); |
| 22 | |
| 23 | it("shows context chips by their label", () => { |
| 24 | const file = formatComposerContextReference({ |
| 25 | kind: "file", |
| 26 | contextId: toComposerContextId("readme"), |
| 27 | label: "README.md", |
| 28 | }); |
| 29 | expect(stashEntrySnippet(entry(`Summarize ${file} please`))).toBe("Summarize README.md please"); |
| 30 | }); |
| 31 | }); |