fix(FN-1600): update merger tests for -X theirs escalation strategy
The FN-1598 merger.ts async conversion introduced an escalation strategy where attempt 3 uses -X theirs and succeeds when AI fails. The tests were expecting the merge to fail after 3 AI attempts, but now attempt 3 succeeds via the theirs strategy. This commit fixes the test mocks to make the -X theirs merge fail so all 3 attempts exhaust and the function throws as expected.
This commit is contained in:
@@ -541,8 +541,21 @@ describe("In-review merge handling after restart", () => {
|
||||
// Branch exists, merge starts, agent creates but prompt fails
|
||||
mockedExecSync.mockImplementation((cmd: any) => {
|
||||
const cmdStr = String(cmd);
|
||||
// Make merge fail so all attempts exhaust
|
||||
if (cmdStr.includes("merge --squash") || cmdStr.includes("merge -X")) {
|
||||
const err = new Error("Merge conflict");
|
||||
err.name = "ExecSyncError";
|
||||
throw err;
|
||||
}
|
||||
if (cmdStr.includes("diff --cached --quiet")) return "1" as any;
|
||||
if (cmdStr.includes("diff --cached")) return "0" as any;
|
||||
if (cmdStr.includes("diff --name-only --diff-filter=U")) return "src/file.ts";
|
||||
// Make auto-resolution fail by making git add fail
|
||||
if (cmdStr.includes("git add")) {
|
||||
const err = new Error("git add failed");
|
||||
err.name = "ExecSyncError";
|
||||
throw err;
|
||||
}
|
||||
return Buffer.from("");
|
||||
});
|
||||
|
||||
@@ -827,8 +840,21 @@ describe("Crash scenario edge cases", () => {
|
||||
|
||||
mockedExecSync.mockImplementation((cmd: any) => {
|
||||
const cmdStr = String(cmd);
|
||||
// Make merge fail so all attempts exhaust
|
||||
if (cmdStr.includes("merge --squash") || cmdStr.includes("merge -X")) {
|
||||
const err = new Error("Merge conflict");
|
||||
err.name = "ExecSyncError";
|
||||
throw err;
|
||||
}
|
||||
// Post-squash check: squash staged changes → "1"
|
||||
if (cmdStr.includes("diff --cached --quiet")) return "1" as any;
|
||||
if (cmdStr.includes("diff --name-only --diff-filter=U")) return "src/file.ts";
|
||||
// Make auto-resolution fail by making git add fail
|
||||
if (cmdStr.includes("git add")) {
|
||||
const err = new Error("git add failed");
|
||||
err.name = "ExecSyncError";
|
||||
throw err;
|
||||
}
|
||||
return Buffer.from("");
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user