import { readFileSync } from "node:fs"; import { resolve } from "node:path"; import { describe, expect, test } from "vitest"; const pageSource = readFileSync(resolve(__dirname, "../DatabaseManagementPage.tsx"), "utf8"); const componentSource = (name: string) => readFileSync(resolve(__dirname, name), "utf8"); describe("history action placement", () => { test("workspace header does not own database history actions", () => { const fleetHeader = pageSource.slice(pageSource.indexOf('title="Database management"'), pageSource.indexOf("kpis={")); expect(fleetHeader).not.toContain("Description history"); expect(fleetHeader).not.toContain("Sensitive history"); }); test("database views expose metadata histories beside database commands", () => { for (const file of ["DatabaseForm.tsx", "DatabaseTables.tsx", "DatabaseRelationships.tsx"]) { const source = componentSource(file); expect(source, file).toContain("Description history"); expect(source, file).toContain("Sensitive history"); } }); });