SPB Git

Repository Public

orchestrator.test.ts 1.4 KB 28 lines typescript

1import { describe, expect, it } from "vitest";23// The autonomy policy is a pure function of (mode, status). Mirrored here to test it without Redis or PostgreSQL.4const NEXT: Record<string, string | undefined> = { draft: "concept", pitched: "script", scripted: "storyboard", storyboarded: "keyframes", keyframes: "voice", voiced: "video", filmed: "assemble", assembled: "qa" };5const PAID = ["video"];6function autoNext(mode: "manual" | "assisted" | "autonomous", status: string) {7  const next = NEXT[status];8  if (!next || mode === "manual") return null;9  if (mode === "assisted" && PAID.includes(next)) return null;10  return next;11}1213describe("autonomy modes", () => {14  it("manual never advances on its own", () => { for (const s of Object.keys(NEXT)) expect(autoNext("manual", s)).toBeNull(); });15  it("assisted runs the cheap stages and stops before paid video", () => {16    expect(autoNext("assisted", "pitched")).toBe("script");17    expect(autoNext("assisted", "keyframes")).toBe("voice");18    expect(autoNext("assisted", "voiced")).toBeNull();19    expect(autoNext("assisted", "filmed")).toBe("assemble");20  });21  it("autonomous runs through QA and then stops: publication is a separate, gated decision", () => {22    expect(autoNext("autonomous", "voiced")).toBe("video");23    expect(autoNext("autonomous", "assembled")).toBe("qa");24    expect(autoNext("autonomous", "qa_passed")).toBeNull();25    expect(autoNext("autonomous", "qa_failed")).toBeNull();26  });27});28
Files main
Menu

Theme