// @vitest-environment node import { readFileSync } from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; import { describe, expect, it } from "vitest"; const appDirectory = path.dirname(fileURLToPath(import.meta.url)); const coreRootSurfaceSource = readFileSync(path.join(appDirectory, "root-core-surface.tsx"), "utf8"); const globalStylesSource = readFileSync(path.join(appDirectory, "globals.css"), "utf8"); describe("HiveGrid product typography contract", () => { it("binds the core document to the resilient HiveGrid font stack", () => { expect(coreRootSurfaceSource).toContain('"bg-background font-product"'); expect(coreRootSurfaceSource).not.toContain('"bg-background font-sans"'); expect(globalStylesSource).toContain(".font-product {"); expect(globalStylesSource).toContain( '--product-font-family: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;' ); }); it("keeps Subframe body and heading tokens on the same fallback-safe stack", () => { for (const token of ["--font-title-page", "--font-subtitle", "--font-heading-", "--font-body-default-regular-0", "--font-body-default-medium-0"]) { expect(globalStylesSource).toContain(`${token}: var(--product-font-family);`); } }); });