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:
@@ -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", () => ({
|
||||
|
||||
@@ -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", () => ({
|
||||
|
||||
Reference in New Issue
Block a user