import { fireEvent, render, screen, within } from "@testing-library/react"; import { describe, expect, it, vi } from "vitest"; import { Sidebar } from "./sidebar"; vi.mock("next/link", () => ({ default: ({ href, children, ...props }: { href: string; children: React.ReactNode }) => ( {children} ), })); vi.mock("next/navigation", () => ({ usePathname: () => "/suppliers", })); vi.mock("./auth-provider", () => ({ useAuth: () => ({ user: { name: "Test User", email: "test@example.com" }, logout: vi.fn(), }), })); vi.mock("next-themes", () => ({ useTheme: () => ({ theme: "light", setTheme: vi.fn(), }), })); describe("Sidebar", () => { it("does not show a separate supplier map navigation item", () => { render(); // Desktop + mobile nav trees both render — assert at least one. expect(screen.getAllByText("Suppliers").length).toBeGreaterThan(0); expect(screen.queryByText("Supplier Map")).not.toBeInTheDocument(); }); it("shows pricelist under the Stock section", () => { render(); // Scope to the desktop sidebar (the first