import { renderToString } from "react-dom/server";
import { MemoryRouter } from "react-router-dom";
import { describe, expect, it, vi } from "vitest";
import { ClientDetailTabs } from "./ClientDetailTabs";

vi.mock("../../lib/i18n", () => ({
  t: (key: string, fallback?: string) =>
    ({
      "ui.dev.clients.details.tab.connection": "연동 설정",
      "ui.dev.clients.details.tab.consents": "Consents & Claims",
      "ui.dev.clients.details.tab.settings": "설정",
      "ui.dev.clients.details.tab.relationships": "관계",
    })[key] ??
    fallback ??
    key,
}));

describe("ClientDetailTabs", () => {
  it("exposes the RP user custom claim screen as a first-class tab", () => {
    const html = renderToString(
      <MemoryRouter>
        <ClientDetailTabs activeTab="connection" clientId="client-a" />
      </MemoryRouter>,
    );

    expect(html).toContain("Consents &amp; Claims");
    expect(html).toContain('href="/clients/client-a/consents"');
  });
});
