Open History to see the last commit
1import { describe, expect, it } from "vitest";
2
3import {
4 buildInlineTerminalContextText,
5 formatInlineTerminalContextLabel,
6 textContainsInlineTerminalContextLabels,
7} from "./userMessageTerminalContexts";
8
9describe("userMessageTerminalContexts", () => {
10 it("builds plain inline terminal text labels", () => {
11 expect(
12 buildInlineTerminalContextText([
13 { header: "Terminal 1 lines 12-13" },
14 { header: "Terminal 2 line 4" },
15 ]),
16 ).toBe("@terminal-1:12-13 @terminal-2:4");
17 });
18
19 it("formats individual inline terminal labels compactly", () => {
20 expect(formatInlineTerminalContextLabel("Terminal 1 lines 12-13")).toBe("@terminal-1:12-13");
21 expect(formatInlineTerminalContextLabel("Terminal 2 line 4")).toBe("@terminal-2:4");
22 });
23
24 it("detects inline terminal labels embedded in user message text", () => {
25 expect(
26 textContainsInlineTerminalContextLabels("yo @terminal-1:12-13 whats up", [
27 { header: "Terminal 1 lines 12-13" },
28 ]),
29 ).toBe(true);
30 expect(
31 textContainsInlineTerminalContextLabels("yo whats up", [
32 { header: "Terminal 1 lines 12-13" },
33 ]),
34 ).toBe(false);
35 });
36});