import { readFileSync } from "node:fs"; import { fileURLToPath } from "node:url"; import path from "node:path"; import { describe, expect, test } from "vitest"; const entrySource = readFileSync(path.join(path.dirname(fileURLToPath(import.meta.url)), "entry.client.tsx"), "utf8"); describe("entry.client hydration contract", () => { test("starts hydration immediately while observability initializes in parallel", () => { expect(entrySource).toContain("void initClientObservability().catch"); expect(entrySource).toContain("hydrate();"); expect(entrySource).not.toContain("requestIdleCallback(hydrate)"); expect(entrySource).not.toContain("waitForObservabilityHydrationGrace"); expect(entrySource).not.toContain("OBSERVABILITY_HYDRATION_GRACE_MS"); }); test("uses revisioned locale assets without disabling the browser cache", () => { expect(entrySource).toContain("publicEnv.VITE_APP_REVISION || publicEnv.VITE_SENTRY_RELEASE"); expect(entrySource).toContain("?v=${encodeURIComponent(localeAssetVersion)}"); expect(entrySource).not.toContain('requestOptions: { cache: "no-store" }'); }); });