/**
 * RED-GREEN tests for F-NEW-PRODUCT-DEMO-WORKSPACE (W4.1).
 *
 * Validates the demo fixtures are scan-able, auto-pack-generatable, and
 * their expectedScoreBand annotations reflect the real OWASP scanner output
 * (drift-protection — if scanner severity penalties change, this test
 * catches the mismatch).
 *
 * @connexum/ai-governance  F-NEW-PRODUCT-DEMO-WORKSPACE
 */
import { describe, it } from 'node:test';
import * as assert from 'node:assert/strict';
import { DEMO_AGENTS, getDemoWorkspace } from './demo-workspace.js';
import { scanAgent } from './owasp-agentic-scanner.js';
import { autoGenerateCompanyPack } from './auto-pack-generator.js';
describe('F-NEW-PRODUCT-DEMO-WORKSPACE (W4.1)', () => {
    it('ships exactly 25 demo agents', () => {
        assert.equal(DEMO_AGENTS.length, 25);
    });
    it('covers at least 8 distinct verticals', () => {
        const verticals = new Set(DEMO_AGENTS.map((a) => a.vertical));
        assert.ok(verticals.size >= 8);
    });
    it('every agent has a unique agentId', () => {
        const ids = new Set(DEMO_AGENTS.map((a) => a.agentId));
        assert.equal(ids.size, DEMO_AGENTS.length);
    });
    it('every agent scans without throwing', () => {
        for (const agent of DEMO_AGENTS) {
            const report = scanAgent(agent);
            assert.ok(report.findings, `${agent.agentId} produces findings array`);
            assert.ok(report.buildStructureScore >= 0 && report.buildStructureScore <= 100);
        }
    });
    it('every agent auto-pack-generates without throwing', () => {
        for (const agent of DEMO_AGENTS) {
            const result = autoGenerateCompanyPack(agent, { acceptAllSuggestedRules: true });
            assert.ok(result.pack.id.startsWith('auto-pack-'));
            assert.ok(result.scanReport.findings.length >= 0);
        }
    });
    it('expectedScoreBand annotations match the OWASP scanner output', () => {
        const mismatches = [];
        for (const agent of DEMO_AGENTS) {
            const report = scanAgent(agent);
            if (report.verdict !== agent.expectedScoreBand) {
                mismatches.push({
                    agentId: agent.agentId,
                    expected: agent.expectedScoreBand,
                    actual: report.verdict,
                });
            }
        }
        assert.deepEqual(mismatches, [], `Demo agents have stale expectedScoreBand annotations: ${JSON.stringify(mismatches, null, 2)}`);
    });
    it('at least one EXCELLENT, one CRITICAL, and one NEEDS_REVIEW agent exists in the demo', () => {
        const bands = new Set(DEMO_AGENTS.map((a) => a.expectedScoreBand));
        assert.ok(bands.has('EXCELLENT'));
        assert.ok(bands.has('CRITICAL'));
        assert.ok(bands.has('NEEDS_REVIEW'));
    });
    it('getDemoWorkspace() returns all agents and unique verticals', () => {
        const w = getDemoWorkspace();
        assert.equal(w.agents.length, DEMO_AGENTS.length);
        assert.ok(w.verticals.length >= 8);
    });
    it('getDemoWorkspace({ vertical: "healthcare" }) filters correctly', () => {
        const w = getDemoWorkspace({ vertical: 'healthcare' });
        assert.ok(w.agents.length > 0);
        assert.ok(w.agents.every((a) => a.vertical === 'healthcare'));
    });
    it('demo includes representative frameworks', () => {
        const frameworks = new Set(DEMO_AGENTS.map((a) => a.framework));
        assert.ok(frameworks.has('claude-code'));
        assert.ok(frameworks.has('openai-agents'));
        assert.ok(frameworks.has('langchain'));
        assert.ok(frameworks.has('crew-ai'));
    });
});
//# sourceMappingURL=demo-workspace.test.js.map