import { renderToString } from "react-dom/server"; import { describe, expect, test } from "vitest"; import { Button, DashboardFrame, FooterCell, IconButton, ServiceRow, StatusStrip, TelemetryCard, TelemetryGrid, ThemeToggle, } from "../index"; import { dashboardPreviewFixtures } from "../fixtures"; describe("dashboard UI components", () => { test("renders the primary generic dashboard fixture", () => { const body = renderToString( , ); expect(body).toContain("Operations Console"); expect(body).toContain("Core Throughput"); expect(body).toContain("Queue Workers"); expect(body).toContain("console-header"); expect(body).toContain("telemetry-section"); expect(body).toContain("6 Metrics"); expect(body).toContain('data-variant="system-bus"'); expect(body).toContain("data-icon-name=\"mdi:server-network\""); expect(body).toContain("data-severity=\"warning\""); expect(body).not.toContain("dashboard-title"); }); test("renders another generic dashboard fixture through the same component", () => { const body = renderToString( , ); expect(body).toContain("Support Desk"); expect(body).toContain("Response Window"); expect(body).toContain("Regional Nodes"); expect(body).toContain("data-icon-name=\"mdi:headset\""); expect(body).toContain("data-severity=\"loading\""); }); test("renders optional service and status links as focusable anchors", () => { const service = renderToString( , ); const footer = renderToString( , ); expect(service).toContain(" { const body = renderToString( , ); expect(body).toContain('class="status-strip"'); expect(body).toContain('data-variant="system-bus"'); expect(body).toContain("Nominal"); }); test("renders stable model IDs on group and status containers", () => { const body = renderToString( , ); expect(body).toContain("data-model-id=\"queue-workers\""); expect(body).toContain("data-model-id=\"dashboard-status\""); }); test("does not render progress bars for non-percent metrics without explicit progress", () => { const withoutProgress = renderToString( , ); const withProgress = renderToString( , ); expect(withoutProgress).not.toContain("telemetry-card__bar"); expect(withProgress).toContain("--metric-progress:42%"); }); test("renders telemetry trends through the uPlot chart surface", () => { const body = renderToString( , ); expect(body).toContain('data-chart-library="uplot"'); }); test("renders telemetry as a framed instrument section with indexed cards", () => { const body = renderToString( , ); expect(body).toContain('class="telemetry-section"'); expect(body).toContain("Telemetry"); expect(body).toContain("2 Metrics"); expect(body).toContain('data-metric-index="01"'); expect(body).toContain('class="telemetry-card__index"'); expect(body).toContain('class="telemetry-card__source"'); }); test("base button controls forward native attributes", () => { const button = renderToString(