test(dashboard): mock workflow API in board-mobile and settings-mobile tests

InlineCreateCard now renders WorkflowSelector and SettingsModal renders
ProjectDefaultWorkflowField → WorkflowSelector, both of which call
fetchWorkflows / fetchProjectDefaultWorkflow on mount. These two tests mock
"../../api" with a fixed object that omitted those exports, so the components
threw "No fetchWorkflows export is defined" during render (the failures behind
test shards 1/2; masked earlier by the build break). Add the workflow API
mocks, matching the set already present in InlineCreateCard.test.tsx.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-06-03 18:27:34 -07:00
parent e5386dc7ee
commit e954f1a720
2 changed files with 9 additions and 0 deletions

View File

@@ -26,6 +26,11 @@ vi.mock("../../api", () => ({
} satisfies Partial<Settings>),
updateGlobalSettings: vi.fn(),
fetchAgents: vi.fn().mockResolvedValue([]),
// InlineCreateCard renders WorkflowSelector, which loads these on mount.
fetchWorkflows: vi.fn().mockResolvedValue([]),
fetchProjectDefaultWorkflow: vi.fn().mockResolvedValue({ workflowId: null }),
setProjectDefaultWorkflow: vi.fn().mockResolvedValue({ workflowId: null }),
selectTaskWorkflow: vi.fn().mockResolvedValue({ workflowId: null, enabledWorkflowSteps: [] }),
}));
vi.mock("../../hooks/useBadgeWebSocket", () => ({

View File

@@ -107,6 +107,10 @@ vi.mock("../../api", () => ({
qmdInstallCommand: "bun install -g @tobilu/qmd",
})),
fetchDashboardHealth: vi.fn(() => Promise.resolve({ status: "ok", version: "1.2.3", uptime: 120 })),
// SettingsModal renders ProjectDefaultWorkflowField → WorkflowSelector, which loads these on mount.
fetchWorkflows: vi.fn(() => Promise.resolve([])),
fetchProjectDefaultWorkflow: vi.fn(() => Promise.resolve({ workflowId: null })),
setProjectDefaultWorkflow: vi.fn(() => Promise.resolve({ workflowId: null })),
}));
vi.mock("../../hooks/useMemoryBackendStatus", () => ({