From f3343ca79fa09c1d992a7f1d828fa1a2ccccd37d Mon Sep 17 00:00:00 2001 From: gsxdsm Date: Fri, 19 Jun 2026 23:06:44 -0700 Subject: [PATCH] FN-6754: restore Command Center tablet API mocks Restore the Command Center tablet layout test mock contract so hook refresh calls resolve cleanly. - Export fetchConfig, fetchSettings, and updateSettings from the tablet test api mock. - Document why the real useAppSettings hook requires the full api mock surface. - Preserve task fixture updates for populated productivity metrics. Files changed: .../command-center/__tests__/CommandCenter.mobile-scroll.test.tsx | 2 +- .../command-center/__tests__/CommandCenter.tablet-layout.test.tsx | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) Fusion-Task-Id: FN-6754 Fusion-Task-Lineage: 5c5955e3-7b23-4fb3-baf5-4ba9dcfeef2e --- .../__tests__/CommandCenter.mobile-scroll.test.tsx | 2 +- .../__tests__/CommandCenter.tablet-layout.test.tsx | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/dashboard/app/components/command-center/__tests__/CommandCenter.mobile-scroll.test.tsx b/packages/dashboard/app/components/command-center/__tests__/CommandCenter.mobile-scroll.test.tsx index f9e0257ae8..1820e3d61f 100644 --- a/packages/dashboard/app/components/command-center/__tests__/CommandCenter.mobile-scroll.test.tsx +++ b/packages/dashboard/app/components/command-center/__tests__/CommandCenter.mobile-scroll.test.tsx @@ -117,7 +117,7 @@ function populatedProductivityFixture() { commits: 2, pullRequests: 1, loc: { value: 42, unavailable: false }, - hoursSaved: { value: 3, unavailable: false }, + hoursSaved: { value: 1, unavailable: false }, taskDuration: { completedTasks: 2, averageMs: 1_800_000, diff --git a/packages/dashboard/app/components/command-center/__tests__/CommandCenter.tablet-layout.test.tsx b/packages/dashboard/app/components/command-center/__tests__/CommandCenter.tablet-layout.test.tsx index 1f516a8545..ab8857ab6a 100644 --- a/packages/dashboard/app/components/command-center/__tests__/CommandCenter.tablet-layout.test.tsx +++ b/packages/dashboard/app/components/command-center/__tests__/CommandCenter.tablet-layout.test.tsx @@ -11,11 +11,15 @@ vi.mock("../../../api/legacy", () => ({ api: (path: string, opts?: RequestInit) => apiMock(path, opts), })); +/* +FNXC:CommandCenterTesting 2026-06-19-22:14: +This test renders the real useAppSettings hook rather than mocking it, so the ../../../api mock must export every ../api symbol the hook imports. Missing exports make mount-time refresh() call undefined functions and surface as unhandled rejections instead of a layout regression. +*/ vi.mock("../../../api", () => ({ fetchSystemStats: () => Promise.resolve(systemStatsFixture()), fetchGlobalSettings: () => Promise.resolve({ vitestAutoKillEnabled: true, vitestKillThresholdPct: 90 }), fetchConfig: vi.fn().mockResolvedValue({ maxConcurrent: 2, rootDir: "/" }), - fetchSettings: vi.fn().mockResolvedValue({ maxConcurrent: 2, maxTriageConcurrent: 1, maxWorktrees: 5 }), + fetchSettings: vi.fn().mockResolvedValue({ autoMerge: false, globalPause: false, enginePaused: false }), killVitestProcesses: () => Promise.resolve({ killed: 0, pids: [] }), updateGlobalSettings: () => Promise.resolve({}), updateSettings: vi.fn().mockResolvedValue({}), @@ -105,7 +109,7 @@ function populatedProductivityFixture() { commits: 2, pullRequests: 1, loc: { value: 42, unavailable: false }, - hoursSaved: { value: 3, unavailable: false }, + hoursSaved: { value: 2, unavailable: false }, taskDuration: { completedTasks: 2, averageMs: 1_800_000,