import { describe, expect, it } from "vitest"; import { parsePlatformLeadSourceBootstrapCliArgs } from "./source-bootstrap-cli.js"; describe("platform lead source bootstrap CLI contract", () => { it("requires actor and routing operator as runtime arguments instead of hardcoding a person", () => { expect( parsePlatformLeadSourceBootstrapCliArgs([ "--", "--mode=dry-run", "--actor-admin-user-id=operator_1", "--routing-admin-user-id=haris_runtime_id", "--manifest=/tmp/source-bootstrap.dry.json", "--run-id=source-dry-1", ]) ).toEqual({ mode: "dry-run", actorAdminUserId: "operator_1", routingAdminUserId: "haris_runtime_id", manifestPath: "/tmp/source-bootstrap.dry.json", runId: "source-dry-1", }); }); it("requires the dry-run plan hash before apply", () => { const args = [ "--mode=apply", "--actor-admin-user-id=operator_1", "--routing-admin-user-id=haris_runtime_id", "--manifest=/tmp/source-bootstrap.apply.json", ]; expect(() => parsePlatformLeadSourceBootstrapCliArgs(args)).toThrow(); expect(parsePlatformLeadSourceBootstrapCliArgs([...args, `--expected-plan-sha256=${"f".repeat(64)}`, "--run-id=source-apply-1"])).toMatchObject({ mode: "apply", expectedPlanSha256: "f".repeat(64), }); }); });