Files
codex-game-studio/tests/agents-templates.test.ts
T
MerlinH 94d88fe4e1 feat: expand Codex prompt surfaces
Inline generated project prompts and selected templates into Codex runs, add bounded broad-context discovery, and validate generated surface freshness against current renderer output.

Add richer workflow templates, CLI prompt-surface coverage, and synced truth docs.
2026-05-30 14:33:23 +00:00

57 lines
2.5 KiB
TypeScript

import { describe, expect, test } from "vitest";
import { activeAgentsForMode, canonicalProjectConfigJson, guidanceConfigHash, projectConfigSchema, slugify } from "../src/config.js";
import { validateBaseAgents } from "../src/agents.js";
import { formatTemplateShow, listTemplates, readTemplate, selectTemplates, validateTemplateFiles } from "../src/templates.js";
describe("config, agents, and templates", () => {
test("slug, active agents, and canonical hash are deterministic", () => {
expect(slugify("My Game")).toBe("my-game");
expect(activeAgentsForMode("prototype")).toContain("qa-playtester");
const config = projectConfigSchema.parse(JSON.parse(readTemplate("project_config")));
const hash = guidanceConfigHash(config);
config.project.status = "frozen";
expect(guidanceConfigHash(config)).toBe(hash);
config.project.genre = "Strategy";
expect(guidanceConfigHash(config)).not.toBe(hash);
expect(canonicalProjectConfigJson(config).endsWith("\n")).toBe(true);
});
test("all base prompts and templates have required sections", () => {
expect(validateBaseAgents()).toEqual([]);
expect(validateTemplateFiles()).toEqual([]);
expect(listTemplates().map((t) => t.id).sort()).toEqual([
"analytics_setup",
"art_direction",
"engine_setup",
"feature_spec",
"game_feel_tuning",
"gdd",
"handoff",
"market_analysis",
"playtest_report",
"production_milestone",
"project_config",
"ship_check",
"ui_ux_review"
]);
});
test("template selection is bounded", () => {
expect(selectTemplates("producer", "Create market overview")).toEqual(["market_analysis"]);
expect(selectTemplates("producer", "Create analytics plan")).toEqual(["analytics_setup"]);
expect(selectTemplates("qa-playtester", "Review validation readiness")).toEqual(["playtest_report"]);
expect(selectTemplates("producer", "handoff coordination")).toEqual(["handoff"]);
expect(selectTemplates("qa-playtester", "Review UI usability")).toEqual(["playtest_report", "ui_ux_review"]);
expect(selectTemplates("release-manager", "Check package")).toEqual(["ship_check"]);
});
test("template show includes discoverability metadata before body", () => {
const output = formatTemplateShow("gdd");
expect(output).toContain("ID: gdd");
expect(output).toContain("Category: design");
expect(output).toContain("Path: templates/gdd_template.md");
expect(output).toContain("Roles: game-designer, creative-director");
expect(output).toContain("# Purpose");
});
});