From 8e7b8e139fd12027c9db2f64f1c7619ccd77f9a6 Mon Sep 17 00:00:00 2001 From: Timothy Laurent Date: Mon, 4 May 2026 14:54:55 -0700 Subject: [PATCH] fix(tests): resolve 4 failing tests across cli and dashboard packages - task.test.ts: save/delete GITHUB_REPOSITORY env before runTaskPrCreate fallback test so CI env doesn't bypass the getCurrentRepo code path - app.test.tsx: increase waitForFrameContains timeout for ASCII QR render from 3s to 6s to accommodate slower CI environments - remote-auth.test.ts: switch createRemoteSettings default from tailscale to cloudflare with a static ingressUrl so resolveRemoteBaseUrl doesn't 409 when no tunnel is running Co-Authored-By: Claude Opus 4.6 --- packages/cli/src/commands/__tests__/task.test.ts | 3 +++ .../src/commands/dashboard-tui/__tests__/app.test.tsx | 2 +- packages/dashboard/src/__tests__/remote-auth.test.ts | 10 +++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/commands/__tests__/task.test.ts b/packages/cli/src/commands/__tests__/task.test.ts index 71923a300..a79a2fa16 100644 --- a/packages/cli/src/commands/__tests__/task.test.ts +++ b/packages/cli/src/commands/__tests__/task.test.ts @@ -530,6 +530,8 @@ describe("project-aware task command behavior", () => { }); it("runTaskPrCreate falls back to current working directory without project flag", async () => { + const originalGitHubRepo = process.env.GITHUB_REPOSITORY; + delete process.env.GITHUB_REPOSITORY; const cwdSpy = vi.spyOn(process, "cwd").mockReturnValue("/local/project"); const mockCreatePr = vi.fn().mockResolvedValue({ number: 123, url: "https://example.com/pr/123" }); vi.mocked(isGhAvailable).mockReturnValue(true); @@ -549,6 +551,7 @@ describe("project-aware task command behavior", () => { expect(getCurrentRepo).toHaveBeenCalledWith("/local/project"); expect(mockCreatePr).toHaveBeenCalledWith(expect.objectContaining({ head: "fusion/fn-001" })); cwdSpy.mockRestore(); + if (originalGitHubRepo !== undefined) process.env.GITHUB_REPOSITORY = originalGitHubRepo; }); it("runTaskPlan uses resolved project path only when project name is provided", async () => { diff --git a/packages/cli/src/commands/dashboard-tui/__tests__/app.test.tsx b/packages/cli/src/commands/dashboard-tui/__tests__/app.test.tsx index bae0e49ff..5d9732f6a 100644 --- a/packages/cli/src/commands/dashboard-tui/__tests__/app.test.tsx +++ b/packages/cli/src/commands/dashboard-tui/__tests__/app.test.tsx @@ -560,7 +560,7 @@ describe("Settings view", () => { stdin.write("\u001B[C"); await new Promise((r) => setTimeout(r, 20)); stdin.write("K"); - await waitForFrameContains(lastFrame, "▀▀▀ASCII-QR▀▀▀"); + await waitForFrameContains(lastFrame, "▀▀▀ASCII-QR▀▀▀", 6000); unmount(); }); }); diff --git a/packages/dashboard/src/__tests__/remote-auth.test.ts b/packages/dashboard/src/__tests__/remote-auth.test.ts index fb547bd97..0afa43118 100644 --- a/packages/dashboard/src/__tests__/remote-auth.test.ts +++ b/packages/dashboard/src/__tests__/remote-auth.test.ts @@ -14,20 +14,20 @@ import { function createRemoteSettings(overrides: Partial = {}): RemoteAccessProjectSettings { return { - activeProvider: "tailscale", + activeProvider: "cloudflare", providers: { tailscale: { - enabled: true, - hostname: "tail.example.ts.net", + enabled: false, + hostname: "", targetPort: 4040, acceptRoutes: false, }, cloudflare: { - enabled: false, + enabled: true, quickTunnel: false, tunnelName: "", tunnelToken: null, - ingressUrl: "", + ingressUrl: "https://demo.trycloudflare.com", }, }, tokenStrategy: {