import assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { READ_RULES } from '../src/routes/read-guards';

/**
 * This file used to test `growthReadAllowed`, a scope predicate local to
 * growth.ts. The predicate is gone and the boundary it guarded is now one row
 * in the read table, so what is worth pinning is that growth did not quietly
 * lose its guard in the move — a deletion that would leave the endpoint open
 * and every test still green.
 */
describe('growth read boundary', () => {
  it('is still governed after moving from a local scope check to the table', () => {
    const governed = READ_RULES.filter((rule) => rule.path.startsWith('/api/growth'));

    assert.deepEqual(
      governed.map((rule) => `${rule.method} ${rule.path} ${rule.capability}`),
      [
        'GET /api/growth book:read',
        'GET /api/growth/accounts/:id book:read',
      ],
    );
  });
});
