summaryrefslogtreecommitdiffhomepage
path: root/packages/system-prompt/src/catalog.test.ts
blob: 12999b6463b522547a3b9e4fe3b70d82cb2e705e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { describe, expect, it } from "vitest";
import { getVariableCatalog } from "./catalog.js";

describe("catalog", () => {
  it("lists all fixed variables", () => {
    const catalog = getVariableCatalog();
    const keys = catalog.map((v) => `${v.type}:${v.name}`);

    expect(keys).toContain("system:time");
    expect(keys).toContain("system:date");
    expect(keys).toContain("system:os");
    expect(keys).toContain("system:hostname");
    expect(keys).toContain("prompt:cwd");
    expect(keys).toContain("prompt:model");
    expect(keys).toContain("prompt:conversation_id");
    expect(keys).toContain("git:branch");
    expect(keys).toContain("git:status");
  });

  it("marks the file type as dynamic", () => {
    const fileVar = getVariableCatalog().find((v) => v.type === "file");
    expect(fileVar).toBeDefined();
    expect(fileVar?.dynamic).toBe(true);
  });

  it("every entry has a description", () => {
    for (const v of getVariableCatalog()) {
      expect(v.description.length).toBeGreaterThan(0);
    }
  });
});