import { describe, expect, it } from "@jest/globals";

import {
  buildHardwareDiagram,
  buildNetworkDiagram,
  buildPipelineDiagram,
  fallbackHardware,
  fallbackMetrics,
  fallbackNetwork,
  fallbackServices,
} from "../../../frontend/src/data/sample.js";

describe("sample data builders", () => {
  it("exposes the atlas hardware and service inventory", () => {
    const hardware = fallbackHardware();
    const services = fallbackServices();

    expect(hardware.clusters[0].name).toBe("atlas");
    expect(hardware.specialty.map((node) => node.alias)).toContain("oceanus");
    expect(services.services.some((service) => service.name === "Keycloak")).toBe(true);
    expect(services.services.some((service) => service.name === "AI Chat")).toBe(true);
  });

  it("builds the rendered diagrams and network summary", () => {
    expect(buildHardwareDiagram({})).toContain("Titan Lab");
    expect(buildHardwareDiagram({})).toContain("titan-0a");
    expect(buildNetworkDiagram()).toContain("oauth2-proxy");
    expect(buildPipelineDiagram()).toContain("flux[cd.bstein.dev]");
    expect(fallbackNetwork().ingress_gateway).toContain("Traefik");
    expect(fallbackMetrics()).toEqual({
      dashboard: "https://metrics.bstein.dev",
      description: "Atlas + Oceanus metrics.",
    });
  });
});
