import { describe, expect, test } from "bun:test"; import { renderToString } from "react-dom/server"; import type { DatabaseTableSummary } from "@/src/types"; import DatabaseTableRow from "./database-table-row"; const table: DatabaseTableSummary = { name: "knowledgebase_vectors", type: "virtual", rows: 12, size_bytes: 2048, columns: [], key: { kind: "none" }, }; describe("DatabaseTableRow", () => { test("names the table, its record count and its size", () => { const html = renderToString( {}} />); expect(html).toContain("knowledgebase_vectors"); expect(html).toContain("12"); expect(html).toContain("2.0 KB"); }); test("links to the table's own address", () => { const html = renderToString( {}} />); expect(html).toContain(`href="/admin/settings/database?table=knowledgebase_vectors"`); }); test("a table with no count yet shows a dash", () => { const html = renderToString( {}} />, ); expect(html).toContain("-"); }); });