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
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user