@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

main
ts 37 lines 1.47 KB
Raw
1 import { describe, expect, it } from "vite-plus/test";
2
3 import { buildThreadTitlePrompt } from "./textGenerationPrompts.ts";
4 import { normalizeCliError } from "./textGenerationUtils.ts";
5
6 describe("normalizeCliError", () => {
7 it("does not expose CLI failure details in the public error message", () => {
8 const result = normalizeCliError(
9 "codex",
10 "generateCommitMessage",
11 new Error("request failed with access_token=secret-token"),
12 "Failed to generate a commit message",
13 );
14
15 expect(result.detail).toBe("Failed to generate a commit message");
16 expect(result.message).not.toContain("secret-token");
17 });
18 });
19
20 describe("buildThreadTitlePrompt", () => {
21 it("names the project to leave out and puts the user's instructions above the limits", () => {
22 for (const previousTitle of [undefined, "Hyperdrive Config Crash"]) {
23 const { prompt } = buildThreadTitlePrompt({
24 message: "hyperdrive init crashes without a config",
25 previousTitle,
26 projectTitle: "Hyperdrive",
27 instructions: "Prefix every title with the team name.",
28 });
29 expect(prompt).toContain('Never include the project name ("Hyperdrive")');
30 expect(prompt).not.toContain("fewer than 40 characters");
31 expect(prompt).toContain("Title instructions from the user:\nPrefix every title");
32 }
33 expect(buildThreadTitlePrompt({ message: "Fix login", instructions: " " }).prompt).toContain(
34 "3-8 words, fewer than 40 characters.",
35 );
36 });
37 });