1import { describe, expect, it } from "vite-plus/test";
2import { buildRuntimeInstructions } from "./runtimeInstructions.ts";
3
4describe("buildRuntimeInstructions", () => {
5 it("requires explicit registration of every PR and stack layer", () => {
6 const instructions = buildRuntimeInstructions({ harness: "Codex" });
7 expect(instructions).toContain("When the t3-code MCP server exposes link_pull_request");
8 expect(instructions).toContain("with the full PR URL immediately after creating a PR");
9 expect(instructions).toContain("For a stack, call it for every layer");
10 expect(instructions).toContain("call list_thread_pull_requests and link any PR");
11 });
12
13 it("keeps known model and effort metadata on one line", () => {
14 expect(
15 buildRuntimeInstructions({
16 harness: "Codex",
17 model: " custom\nmodel ",
18 reasoningEffort: " high\n",
19 }),
20 ).toContain("through the Codex harness, as custom model with high reasoning effort.");
21 });
22
23 it("names the model by display name and slug when they differ", () => {
24 expect(
25 buildRuntimeInstructions({ harness: "Codex", model: "gpt-5.4", modelName: "GPT-5.4" }),
26 ).toContain("through the Codex harness, as GPT-5.4 (model slug: gpt-5.4).");
27 expect(
28 buildRuntimeInstructions({ harness: "Codex", model: "my-model", modelName: "my-model" }),
29 ).toContain("through the Codex harness, as my-model.");
30 });
31
32 it.each([undefined, "", "auto", "default"])("omits unresolved model %s", (model) => {
33 const instructions = buildRuntimeInstructions({ harness: "Cursor", model });
34 expect(instructions).toContain("through the Cursor harness.");
35 expect(instructions).not.toContain("reasoning effort");
36 });
37});