Files
fusion/packages/engine/src/__tests__/engine-public-api.test.ts
Fusion 8220ec66b7 feat(FN-4238): export merger errors from engine and polish workflow results
Exports merger error types from the engine package for use in the dashboard and CLI. Adds tests for the engine barrel exports and fixes workflow results tab styling to align the edit toggle with button styles.

Fusion-Task-Id: FN-4238
2026-05-12 20:39:01 -07:00

61 lines
1.5 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
BranchConflictError,
DiffVolumeRegressionError,
MergeAbortedError,
SquashAuditError,
type SquashAuditFindings,
} from "../index.js";
const emptySquashAuditFindings: SquashAuditFindings = {
strategy: "squash",
squashSha: "abc12345",
parentSha: "def67890",
squashSubject: "squash subject",
auditTargetLabel: "abc12345",
lookback: 30,
branchSubjects: [],
recentMainSubjects: [],
duplicateSubjects: [],
touchedFiles: [],
touchedFileOverlaps: [],
findings: [],
issueCount: 0,
clean: true,
};
describe("engine public api barrel", () => {
it.each([
{
name: "BranchConflictError",
ctor: () => new BranchConflictError({
branchName: "task/fn-4238",
conflictingWorktreePath: "/tmp/worktree",
existingTipSha: "0123456789ab",
strandedCommits: [],
startPoint: "main",
recommendedAction: "Rebase the task branch.",
}),
},
{
name: "DiffVolumeRegressionError",
ctor: () => new DiffVolumeRegressionError([]),
},
{
name: "MergeAbortedError",
ctor: () => new MergeAbortedError("merge aborted"),
},
{
name: "SquashAuditError",
ctor: () => new SquashAuditError("FN-4238", "abc12345", emptySquashAuditFindings),
},
])("exports $name from ../index.js", ({ name, ctor }) => {
expect(ctor).toBeTypeOf("function");
const error = ctor();
expect(error).toBeInstanceOf(Error);
expect(error.name).toBe(name);
});
});