import { describe, it, expect } from 'vitest'; import { readFileSync } from 'node:fs'; import { fileURLToPath } from 'node:url'; import { dirname, resolve } from 'node:path'; import { SCOPES } from './scopes'; import { renderScopesMd } from '../../scripts/gen-scopes.mjs'; // SCOPES.md is generated from scopes.ts (the single source of truth). This gate fails the build // (npm test, which the Tangled Spindle runs) if someone edits scopes.ts but forgets // `npm run gen:scopes`, so the human-facing domain list can never silently drift. const here = dirname(fileURLToPath(import.meta.url)); const onDisk = readFileSync(resolve(here, '../../SCOPES.md'), 'utf8'); describe('SCOPES.md', () => { it('is in sync with src/config/scopes.ts — run `npm run gen:scopes`', () => { expect(onDisk).toBe(renderScopesMd(SCOPES)); }); });