import { describe, expect, it, vi } from "vitest"; import { render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { FluentProvider, webLightTheme } from "@fluentui/react-components"; import { MapPage } from "../MapPage"; const mockFetchMapColorThresholds = vi.fn(async () => ({ threshold_low: 10, threshold_medium: 50, threshold_high: 100, })); let lastArgs: { range: string; origin: string } = { range: "", origin: "" }; const mockUseMapData = vi.fn((range: string, origin: string) => { lastArgs = { range, origin }; return { countries: {}, countryNames: {}, bans: [], total: 0, loading: false, error: null, refresh: vi.fn(), }; }); vi.mock("../hooks/useMapData", () => ({ useMapData: (range: string, origin: string) => mockUseMapData(range, origin), })); vi.mock("../api/config", async () => ({ fetchMapColorThresholds: mockFetchMapColorThresholds, })); vi.mock("../components/WorldMap", () => ({ WorldMap: () =>
, })); describe("MapPage", () => { it("renders DashboardFilterBar and updates data when filters change", async () => { const user = userEvent.setup(); render(