Files
projectbrain-Public/backend/test/gitea-autonomy-execution.test.ts

25 lines
1.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { hasGiteaAutonomyCompletionEvidence } from "../src/repositories/autonomyRepository.js";
import { autonomyGiteaBranch, isGiteaAutoExecutionBranch } from "../src/services/giteaAutonomyExecution.js";
describe("Gitea Auto execution contract", () => {
it("derives one deterministic atomic-claim branch from a durable work id", () => {
expect(autonomyGiteaBranch("PHX-003")).toBe("projectbrain/auto/phx-003");
expect(autonomyGiteaBranch(" UI / Polish #4 ")).toBe("projectbrain/auto/ui-polish-4");
expect(isGiteaAutoExecutionBranch("projectbrain/auto/phx-003")).toBe(true);
expect(isGiteaAutoExecutionBranch("chatgpt/other-work")).toBe(false);
});
it("requires merge, exact head and validation evidence before Gitea completion is authoritative", () => {
expect(hasGiteaAutonomyCompletionEvidence([
"gitea:auto:merge:abc",
"gitea:auto:head:def",
])).toBe(false);
expect(hasGiteaAutonomyCompletionEvidence([
"gitea:auto:merge:abc",
"gitea:auto:head:def",
"gitea:auto:validation:42",
])).toBe(true);
});
});