// @vitest-environment jsdom import "@testing-library/jest-dom"; import { render, screen } from "@testing-library/react"; import { MemoryRouter } from "react-router"; import { describe, expect, it, vi } from "vitest"; import type { ApiSpecsDto } from "../services/ApiSpecsService"; import ApiSpecs from "./ApiSpecs"; vi.mock("~/components/editors/MonacoEditor", () => ({ default: ({ value }: { value: string }) =>
{value} }));
vi.mock("~/components/ui/icons/ExternalLinkEmptyIcon", () => ({ default: () => null }));
vi.mock("react-i18next", () => ({ useTranslation: () => ({ t: (key: string) => key }) }));
const item = {
openApi: { openapi: "3.1.0" },
postmanCollection: { info: { name: "API" }, item: [] },
apiDocsUrl: "https://api.example.com/v1/docs",
} as unknown as ApiSpecsDto;
describe("ApiSpecs", () => {
it("can hide the admin-only Postman download while still rendering the collection preview", () => {
render(