import assert from 'node:assert/strict'; import { readFileSync } from 'node:fs'; import { join } from 'node:path'; import test from 'node:test'; test('server data save failures are surfaced through a global browser event', () => { const source = readFileSync(join(process.cwd(), 'lib/server-data.ts'), 'utf8'); assert.match(source, /export const SERVER_DATA_SAVE_ERROR_EVENT = 'ftb:server-data-save-error';/); assert.match(source, /window\.dispatchEvent\(\s*new CustomEvent\(SERVER_DATA_SAVE_ERROR_EVENT/); }); test('layout shell renders the global server data save error banner', () => { const source = readFileSync(join(process.cwd(), 'components/layout/LayoutShell.tsx'), 'utf8'); assert.match(source, /import \{ ServerDataSaveErrorBanner \} from '@\/components\/ServerDataSaveErrorBanner';/); assert.match(source, //); });