fix(FN-4383): satisfy tsc signatures in exec mock implementations

Fusion-Task-Id: FN-4383
Fusion-Task-Lineage: 69516bdf-34d1-405c-8bc9-b558c4780863
This commit is contained in:
Fusion
2026-05-13 15:20:24 -07:00
committed by gsxdsm
parent fab7de4147
commit ff4f6b22d0
2 changed files with 16 additions and 8 deletions

View File

@@ -27,7 +27,10 @@ describe("captureBaseCommitSha", () => {
}); });
it("captures merge-base for fresh worktree", async () => { it("captures merge-base for fresh worktree", async () => {
mockedExec.mockImplementation((cmd: any, _opts: any, cb: any) => cb(null, cmd.includes("merge-base") ? "abc1234\n" : "")); mockedExec.mockImplementation(((cmd: any, _opts: any, cb: any) => {
cb(null, cmd.includes("merge-base") ? "abc1234\n" : "");
return {} as any;
}) as any);
const store = createMockStore(); const store = createMockStore();
const executor = new TaskExecutor(store, "/tmp/test"); const executor = new TaskExecutor(store, "/tmp/test");
const audit = { git: vi.fn().mockResolvedValue(undefined) }; const audit = { git: vi.fn().mockResolvedValue(undefined) };
@@ -54,7 +57,10 @@ describe("captureBaseCommitSha", () => {
mockedExecSync.mockImplementation(() => { mockedExecSync.mockImplementation(() => {
throw new Error("not ancestor"); throw new Error("not ancestor");
}); });
mockedExec.mockImplementation((cmd: any, _opts: any, cb: any) => cb(null, cmd.includes("merge-base") ? "new456\n" : "")); mockedExec.mockImplementation(((cmd: any, _opts: any, cb: any) => {
cb(null, cmd.includes("merge-base") ? "new456\n" : "");
return {} as any;
}) as any);
const store = createMockStore(); const store = createMockStore();
const executor = new TaskExecutor(store, "/tmp/test"); const executor = new TaskExecutor(store, "/tmp/test");
const audit = { git: vi.fn().mockResolvedValue(undefined) }; const audit = { git: vi.fn().mockResolvedValue(undefined) };
@@ -77,13 +83,14 @@ describe("captureBaseCommitSha", () => {
}); });
it("falls back to HEAD when merge-base fails", async () => { it("falls back to HEAD when merge-base fails", async () => {
mockedExec.mockImplementation((cmd: any, _opts: any, cb: any) => { mockedExec.mockImplementation(((cmd: any, _opts: any, cb: any) => {
if (String(cmd).includes("merge-base")) { if (String(cmd).includes("merge-base")) {
cb(new Error("merge-base failed"), "", "merge-base failed"); cb(new Error("merge-base failed"), "", "merge-base failed");
return; return {} as any;
} }
cb(null, "head777\n", ""); cb(null, "head777\n", "");
}); return {} as any;
}) as any);
const store = createMockStore(); const store = createMockStore();
const executor = new TaskExecutor(store, "/tmp/test"); const executor = new TaskExecutor(store, "/tmp/test");
const audit = { git: vi.fn().mockResolvedValue(undefined) }; const audit = { git: vi.fn().mockResolvedValue(undefined) };

View File

@@ -1904,13 +1904,14 @@ describe("TaskExecutor worktree pool integration", () => {
} }
return "" as any; return "" as any;
}); });
mockedExec.mockImplementation((cmd: any, _opts: any, cb: any) => { mockedExec.mockImplementation(((cmd: any, _opts: any, cb: any) => {
if (String(cmd).includes("git merge-base HEAD origin/main")) { if (String(cmd).includes("git merge-base HEAD origin/main")) {
cb(null, "newbase123\n", ""); cb(null, "newbase123\n", "");
return; return {} as any;
} }
cb(null, "", ""); cb(null, "", "");
}); return {} as any;
}) as any);
const store = createMockStore(); const store = createMockStore();
store.getTask.mockResolvedValue({ store.getTask.mockResolvedValue({