fix(canvas): mock WorkspaceUsage in BudgetLimit.DetailsTab test
DetailsTab renders WorkspaceUsage alongside BudgetSection. The test suite sets api.get to return [] (a valid empty peers list) but WorkspaceUsage calls api.get for metrics and crashes on undefined input_tokens when the mock returns an array instead of a WorkspaceMetrics object. Add a stub vi.mock following the same pattern already used for BudgetSection. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
40a8e41808
commit
28dfa185aa
@ -44,6 +44,15 @@ vi.mock("../tabs/BudgetSection", () => ({
|
||||
),
|
||||
}));
|
||||
|
||||
// Mock WorkspaceUsage — it has its own test suite (WorkspaceUsage.test.tsx).
|
||||
// Without this mock its internal api.get call races against the shared mock
|
||||
// and crashes when the return value is not a valid WorkspaceMetrics object.
|
||||
vi.mock("../WorkspaceUsage", () => ({
|
||||
WorkspaceUsage: ({ workspaceId }: { workspaceId: string }) => (
|
||||
<div data-testid="workspace-usage-stub" data-ws={workspaceId} />
|
||||
),
|
||||
}));
|
||||
|
||||
import { api } from "@/lib/api";
|
||||
import { DetailsTab } from "../tabs/DetailsTab";
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user