test: restore the four workspace-merge tests broken by a stale mock
project-engine.test.ts hand-writes a factory for ../merge/merger-ai.js, and it had drifted from the module: WorkspaceMergeDispatchSupersededError was missing. Production imports that class, so the merge-queue drain threw "No <export> is defined on the mock" before the code under test ran — the four Phase C hardening cases then failed on a resolved promise and an absent updateTask call, for a reason unrelated to what they assert. No product change. All 114 tests in the file pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
7
.changeset/workspace-merge-test-mock-export.md
Normal file
7
.changeset/workspace-merge-test-mock-export.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
"@runfusion/fusion": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
summary: Repair four red workspace-merge tests caused by a stale module mock.
|
||||||
|
category: internal
|
||||||
|
dev: `project-engine.test.ts` mocks `../merge/merger-ai.js` with a hand-written factory that had not kept up with the module's exports: `WorkspaceMergeDispatchSupersededError` was missing. Production imports it, so the merge-queue drain threw "No <export> is defined on the mock" before reaching the behaviour under test, and the four Phase C hardening cases failed on a resolved promise and a missing `updateTask` call rather than on what they assert. No product change; the factory now provides the class and carries a note to keep it in step with merger-ai's exported errors.
|
||||||
@@ -136,12 +136,26 @@ vi.mock("../merge/merger-ai.js", () => {
|
|||||||
this.name = "WorkspaceFinalizeBlockedError";
|
this.name = "WorkspaceFinalizeBlockedError";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
FNXC:WorkspaceMerge 2026-08-19-04:00:
|
||||||
|
Production imports this error from merger-ai, so a factory that omits it makes the merge-queue
|
||||||
|
drain throw "No <export> is defined on the mock" BEFORE reaching the behaviour under test — the
|
||||||
|
four Phase C hardening cases then saw a resolved promise and no updateTask call, failing for a
|
||||||
|
reason unrelated to what they assert. Keep this list in step with merger-ai's exported errors.
|
||||||
|
*/
|
||||||
|
class WorkspaceMergeDispatchSupersededError extends Error {
|
||||||
|
constructor(public readonly taskId: string) {
|
||||||
|
super(`Workspace merge dispatch lease was superseded before finalization for ${taskId}`);
|
||||||
|
this.name = "WorkspaceMergeDispatchSupersededError";
|
||||||
|
}
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
runAiMerge: mocks.runAiMerge,
|
runAiMerge: mocks.runAiMerge,
|
||||||
landWorkspaceTask: mocks.landWorkspaceTask,
|
landWorkspaceTask: mocks.landWorkspaceTask,
|
||||||
WorkspaceRepoLandBusyError,
|
WorkspaceRepoLandBusyError,
|
||||||
WorkspacePartialLandError,
|
WorkspacePartialLandError,
|
||||||
WorkspaceFinalizeBlockedError,
|
WorkspaceFinalizeBlockedError,
|
||||||
|
WorkspaceMergeDispatchSupersededError,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user