Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

1.2 KB
Raw Blame
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { ModelCustomMetadata } from "./ModelCustomMetadata";

describe("ModelCustomMetadata", () => {
  it("renders each tag and every metadata entry with its value", () => {
    render(
      <ModelCustomMetadata
        customTags={["deprecated", "ptu"]}
        customMetadata={{ retirement_date: "2027-03-01", provisioned_ptu: 100, gsu: false }}
      />,
    );
    expect(screen.getByText("Tags:")).toBeInTheDocument();
    expect(screen.getByText("deprecated")).toBeInTheDocument();
    expect(screen.getByText("ptu")).toBeInTheDocument();
    const terms = screen.getAllByRole("term").map((term) => term.textContent);
    const definitions = screen.getAllByRole("definition").map((definition) => definition.textContent);
    expect(terms.map((term, index) => [term, definitions[index]])).toEqual([
      ["retirement_date", "2027-03-01"],
      ["provisioned_ptu", "100"],
      ["gsu", "false"],
    ]);
  });

  it("renders nothing when the model has no tags or metadata", () => {
    const { container } = render(<ModelCustomMetadata customTags={null} customMetadata={{}} />);
    expect(container).toBeEmptyDOMElement();
  });
});