test(ui): mock the app router for the cost optimization activity test

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Krrish Dholakia 2026-07-24 20:38:13 +00:00
parent b15e0e6ade
commit 510680fcfe

View file

@ -3,10 +3,15 @@ import { describe, expect, it, vi } from "vitest";
const mockUserDailyActivityCall = vi.fn();
vi.mock("next/navigation", () => ({
useRouter: () => ({ push: vi.fn() }),
}));
vi.mock("@/components/networking", () => ({
userDailyActivityCall: (...args: unknown[]) => mockUserDailyActivityCall(...args),
getToolSpend: vi.fn().mockResolvedValue({ by_tool: [], daily: [], total_spend: 0, start_date: null, end_date: null }),
getGeneralSettingsCall: vi.fn().mockResolvedValue([]),
serverRootPath: "",
}));
vi.mock("@/components/shared/advanced_date_picker", () => ({