test(FN-4946): add implicit completion refusal guard coverage
Fusion-Task-Id: FN-4946 Fusion-Task-Lineage: 9a48f72f-d2cc-4950-8a00-f69053dd1163
This commit is contained in:
committed by
gsxdsm
parent
8a050be8f3
commit
3a17b85ed6
@@ -0,0 +1,38 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { evaluateTaskDoneRefusal } from "../executor.js";
|
||||
|
||||
describe("FN-4946 shared task_done refusal helper invariant", () => {
|
||||
it("keeps a single helper implementation and routes explicit+implicit paths through it", () => {
|
||||
const source = readFileSync(new URL("../executor.ts", import.meta.url), "utf8");
|
||||
const invocations = source.match(/evaluateTaskDoneRefusal\(/g) ?? [];
|
||||
const helperDecl = source.match(/\bfunction evaluateTaskDoneRefusal\b/g) ?? [];
|
||||
const dissentDecl = source.match(/\bconst DISSENT_PATTERNS\b/g) ?? [];
|
||||
|
||||
expect(invocations.length).toBeGreaterThanOrEqual(3);
|
||||
expect(helperDecl).toHaveLength(1);
|
||||
expect(dissentDecl).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("returns pending-code-review-revise for a pending step with REVISE and no summary", () => {
|
||||
const result = evaluateTaskDoneRefusal(
|
||||
{
|
||||
id: "FN-4946-H",
|
||||
title: "t",
|
||||
description: "",
|
||||
column: "in-progress",
|
||||
dependencies: [],
|
||||
steps: [{ name: "Step 1", status: "in-progress" }],
|
||||
currentStep: 0,
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
} as any,
|
||||
{},
|
||||
new Map([[0, "REVISE"]]),
|
||||
);
|
||||
|
||||
expect(result.ok).toBe(false);
|
||||
if (result.ok) throw new Error("expected refusal");
|
||||
expect(result.refusalClass).toBe("pending-code-review-revise");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user