import { render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
import { AdminDiagnosticsPanel } from "./AdminDiagnosticsPanel";

vi.mock("@tanstack/react-query", () => ({
  useQuery: () => ({
    isLoading: false,
    data: { checks: [{ id: "secret", status: "ok", message: "JWT configured" }] }
  })
}));

vi.mock("../api/adminApi", () => ({
  getAdminDiagnostics: vi.fn()
}));

describe("AdminDiagnosticsPanel", () => {
  it("renders diagnostics checks", () => {
    render(<AdminDiagnosticsPanel />);
    expect(screen.getByRole("heading", { name: "Diagnostics" })).toBeInTheDocument();
    expect(screen.getByText("JWT configured")).toBeInTheDocument();
  });
});
