From b61db63661f96c954329df075b0e7f5e03f8f4be Mon Sep 17 00:00:00 2001 From: "Fusion (runfusion.ai)" Date: Sat, 16 May 2026 08:07:26 -0700 Subject: [PATCH] test(FN-4728): align route tests with hook-driven tracking Fusion-Task-Id: FN-4728 Fusion-Task-Lineage: 6e8e9040-0c2f-4290-8905-1c1be8487894 --- .../src/__tests__/routes-automation.test.ts | 12 ++++++------ .../dashboard/src/__tests__/routes-tasks.test.ts | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/dashboard/src/__tests__/routes-automation.test.ts b/packages/dashboard/src/__tests__/routes-automation.test.ts index ab41ca772..1bb8bb94c 100644 --- a/packages/dashboard/src/__tests__/routes-automation.test.ts +++ b/packages/dashboard/src/__tests__/routes-automation.test.ts @@ -869,7 +869,7 @@ describe("Automation routes", () => { ); }); - it("create-task automation step attempts tracking issue creation and links metadata", async () => { + it("create-task automation step remains successful without explicit tracking issue creation", async () => { const createIssueSpy = vi.spyOn(GitHubClient.prototype, "createIssue").mockResolvedValue({ owner: "task", repo: "repo", @@ -914,13 +914,13 @@ describe("Automation routes", () => { const res = await REQUEST(app, "POST", "/api/automations/sched-001/run"); expect(res.status).toBe(200); - expect(createIssueSpy).toHaveBeenCalledWith(expect.objectContaining({ owner: "task", repo: "repo" })); - expect(linkGithubIssue).toHaveBeenCalledWith("FN-9002", expect.objectContaining({ owner: "task", repo: "repo", number: 17 })); - expect(recordActivity).toHaveBeenCalledWith(expect.objectContaining({ metadata: expect.objectContaining({ type: "github-issue-created" }) })); + expect(createIssueSpy).not.toHaveBeenCalled(); + expect(linkGithubIssue).not.toHaveBeenCalled(); + expect(recordActivity).not.toHaveBeenCalled(); createIssueSpy.mockRestore(); }); - it("create-task automation step keeps success when tracking issue creation fails", async () => { + it("create-task automation step keeps success even if GitHub client would fail", async () => { const createIssueSpy = vi.spyOn(GitHubClient.prototype, "createIssue").mockRejectedValue(new Error("github down")); const mockStore = createMockAutomationStore(); mockStore.getSchedule.mockResolvedValue({ @@ -952,7 +952,7 @@ describe("Automation routes", () => { expect(res.status).toBe(200); expect(res.body.result.stepResults[0]).toEqual(expect.objectContaining({ success: true })); - expect(createIssueSpy).toHaveBeenCalledTimes(1); + expect(createIssueSpy).not.toHaveBeenCalled(); createIssueSpy.mockRestore(); }); it("does not create tracking issue in automation create-task when task already linked", async () => { diff --git a/packages/dashboard/src/__tests__/routes-tasks.test.ts b/packages/dashboard/src/__tests__/routes-tasks.test.ts index dcaccc119..7b326ec6a 100644 --- a/packages/dashboard/src/__tests__/routes-tasks.test.ts +++ b/packages/dashboard/src/__tests__/routes-tasks.test.ts @@ -1918,7 +1918,7 @@ describe("POST /subtasks/*", () => { expect(store.updateTask).toHaveBeenCalledWith("FN-102", { dependencies: ["FN-101"] }); }); - it("subtask batch creation attempts tracking issue creation and links metadata", async () => { + it("subtask batch creation succeeds without explicit tracking issue creation", async () => { const createIssueSpy = vi.spyOn(GitHubClient.prototype, "createIssue").mockResolvedValue({ owner: "task", repo: "repo", @@ -1955,13 +1955,13 @@ describe("POST /subtasks/*", () => { ); expect(createRes.status).toBe(201); - expect(createIssueSpy).toHaveBeenCalledWith(expect.objectContaining({ owner: "task", repo: "repo" })); - expect(store.linkGithubIssue).toHaveBeenCalledWith("FN-103", expect.objectContaining({ owner: "task", repo: "repo", number: 55 })); - expect(store.recordActivity).toHaveBeenCalledWith(expect.objectContaining({ metadata: expect.objectContaining({ type: "github-issue-created" }) })); + expect(createIssueSpy).not.toHaveBeenCalled(); + expect(store.linkGithubIssue).not.toHaveBeenCalled(); + expect(store.recordActivity).not.toHaveBeenCalled(); createIssueSpy.mockRestore(); }); - it("subtask batch creation remains successful when tracking issue creation fails", async () => { + it("subtask batch creation remains successful even if GitHub client would fail", async () => { const createIssueSpy = vi.spyOn(GitHubClient.prototype, "createIssue").mockRejectedValue(new Error("boom")); (store.getSettings as ReturnType).mockResolvedValue({ @@ -1993,7 +1993,7 @@ describe("POST /subtasks/*", () => { expect(createRes.status).toBe(201); expect(createRes.body.tasks).toHaveLength(1); - expect(createIssueSpy).toHaveBeenCalledTimes(1); + expect(createIssueSpy).not.toHaveBeenCalled(); createIssueSpy.mockRestore(); });