Files
codex-game-studio/tests/codex-session.test.ts
T
df25f80960 chore: remove stale planning artifacts (#2)
* feat: add flexible studio depth foundations

- add context manifests, engine references, and studio policy gates

- refresh Truthmark 2.2.1 generated surfaces and lane docs

- update OpenSpec tasks and validation coverage

* docs: add Open Game Studio product truth

- add product-capability truth doc for the Codex-native CLI

- cross-link product and engineering truth in route YAML

- update product truth index

* chore: remove stale planning artifacts

---------

Co-authored-by: MerlinH <merlinh221@gmail.com>
2026-06-17 18:47:15 +10:00

52 lines
1.5 KiB
TypeScript

import { describe, expect, test } from "vitest";
import { createCodexStudioSession, validateCodexStudioSession } from "../src/codex-session.js";
describe("Codex studio sessions", () => {
test("constructs default sandbox settings by phase", () => {
const plan = createCodexStudioSession({
projectRoot: "/repo/projects/game",
role: "producer",
objective: "Plan the milestone",
phase: "plan"
});
expect(plan.allowFileEdits).toBe(false);
expect(plan.sandbox).toBe("read-only");
expect(plan.contextFiles).toEqual(["AGENTS.md", ".codex/studio.json"]);
const impl = createCodexStudioSession({
projectRoot: "/repo/projects/game",
role: "gameplay-programmer",
objective: "Implement movement",
phase: "implement"
});
expect(impl.allowFileEdits).toBe(true);
expect(impl.sandbox).toBe("danger-full-access");
});
test("rejects invalid sessions and writable sandbox without file edits", () => {
expect(() =>
validateCodexStudioSession({
projectRoot: "",
role: "producer",
objective: "x",
phase: "plan",
contextFiles: [],
expectedOutputs: [],
allowFileEdits: false,
sandbox: "read-only"
})
).toThrow(/project root/i);
expect(() =>
createCodexStudioSession({
projectRoot: "/repo",
role: "producer",
objective: "x",
phase: "review",
sandbox: "workspace-write",
allowFileEdits: false
})
).toThrow(/writable sandbox/i);
});
});