import { QueryClientProvider } from "@tanstack/react-query"; import { fireEvent, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { MemoryRouter, useLocation } from "react-router-dom"; import { beforeEach, describe, expect, it, vi } from "vitest"; import Footer from "@/components/Footer"; import GroupSwitch from "@/components/GroupSwitch"; import { ServerDetailChartLoading, ServerDetailLoading, } from "@/components/loading/ServerDetailLoading"; import TabSwitch from "@/components/TabSwitch"; import { createTestQueryClient, renderWithProviders } from "@/test/utils"; const apiMocks = vi.hoisted(() => ({ fetchSetting: vi.fn(), })); vi.mock("@/lib/nezha-api", () => apiMocks); function LocationProbe() { const location = useLocation(); return

{location.pathname}

; } describe("Footer", () => { beforeEach(() => { apiMocks.fetchSetting.mockResolvedValue({ success: true, data: { config: { debug: false, language: "en-US", site_name: "Nezha", user_template: "", admin_template: "", custom_code: "", }, version: "9.9.9", }, }); }); it("renders setting version and project attribution", async () => { renderWithProviders(