import test from "node:test"; import assert from "node:assert/strict"; import path from "node:path"; import { readFile } from "node:fs/promises"; import { fileURLToPath } from "node:url"; const testsDir = path.dirname(fileURLToPath(import.meta.url)); async function readWorkspaceFile(relativePath: string) { return readFile(path.join(testsDir, "..", relativePath), "utf8"); } test("thread detail page refreshes when context risk updates for its project", async () => { const source = await readWorkspaceFile("src/app/threads/[threadId]/page.tsx"); assert.match(source, /import \{ RealtimeRefresh \}/, "expected thread page to import RealtimeRefresh"); assert.match(source, /projectId=\{detail\.snapshot\.projectId\}/, "expected thread page to scope realtime refresh to its project"); assert.match(source, /"project\.context_risk\.updated"/, "expected thread page to listen for context risk updates"); }); test("me and about pages refresh when OTA status changes", async () => { const [mePage, aboutPage] = await Promise.all([ readWorkspaceFile("src/app/me/page.tsx"), readWorkspaceFile("src/app/me/about/page.tsx"), ]); for (const [label, source] of [ ["me", mePage], ["about", aboutPage], ] as const) { assert.match(source, / { const [opsPage, auditPage] = await Promise.all([ readWorkspaceFile("src/app/me/ops/page.tsx"), readWorkspaceFile("src/app/me/ops/audit/page.tsx"), ]); for (const [label, source] of [ ["ops", opsPage], ["audit", auditPage], ] as const) { assert.match(source, /