import { readdirSync, readFileSync } from 'node:fs';
import { join } from 'node:path';
import { describe, expect, it } from 'vitest';

describe('catalog domain purity', () => {
  it('has zero database or HTTP imports (AC1)', () => {
    const domainDir = new URL('../domain', import.meta.url);
    const files = readdirSync(domainDir).filter((file) => file.endsWith('.ts'));

    for (const file of files) {
      const source = readFileSync(join(domainDir.pathname, file), 'utf8');
      expect(source).not.toMatch(/from ['"](?:pg|fastify|node:http)/);
      expect(source).not.toMatch(/from ['"].*(?:api|infrastructure)/);
    }
  });
});
