"use strict";
/**
 * 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
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
const node_test_1 = require("node:test");
const assert = __importStar(require("node:assert/strict"));
const demo_workspace_1 = require("./demo-workspace");
const owasp_agentic_scanner_1 = require("./owasp-agentic-scanner");
const auto_pack_generator_1 = require("./auto-pack-generator");
(0, node_test_1.describe)('F-NEW-PRODUCT-DEMO-WORKSPACE (W4.1)', () => {
    (0, node_test_1.it)('ships exactly 25 demo agents', () => {
        assert.equal(demo_workspace_1.DEMO_AGENTS.length, 25);
    });
    (0, node_test_1.it)('covers at least 8 distinct verticals', () => {
        const verticals = new Set(demo_workspace_1.DEMO_AGENTS.map((a) => a.vertical));
        assert.ok(verticals.size >= 8);
    });
    (0, node_test_1.it)('every agent has a unique agentId', () => {
        const ids = new Set(demo_workspace_1.DEMO_AGENTS.map((a) => a.agentId));
        assert.equal(ids.size, demo_workspace_1.DEMO_AGENTS.length);
    });
    (0, node_test_1.it)('every agent scans without throwing', () => {
        for (const agent of demo_workspace_1.DEMO_AGENTS) {
            const report = (0, owasp_agentic_scanner_1.scanAgent)(agent);
            assert.ok(report.findings, `${agent.agentId} produces findings array`);
            assert.ok(report.buildStructureScore >= 0 && report.buildStructureScore <= 100);
        }
    });
    (0, node_test_1.it)('every agent auto-pack-generates without throwing', () => {
        for (const agent of demo_workspace_1.DEMO_AGENTS) {
            const result = (0, auto_pack_generator_1.autoGenerateCompanyPack)(agent, { acceptAllSuggestedRules: true });
            assert.ok(result.pack.id.startsWith('auto-pack-'));
            assert.ok(result.scanReport.findings.length >= 0);
        }
    });
    (0, node_test_1.it)('expectedScoreBand annotations match the OWASP scanner output', () => {
        const mismatches = [];
        for (const agent of demo_workspace_1.DEMO_AGENTS) {
            const report = (0, owasp_agentic_scanner_1.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)}`);
    });
    (0, node_test_1.it)('at least one EXCELLENT, one CRITICAL, and one NEEDS_REVIEW agent exists in the demo', () => {
        const bands = new Set(demo_workspace_1.DEMO_AGENTS.map((a) => a.expectedScoreBand));
        assert.ok(bands.has('EXCELLENT'));
        assert.ok(bands.has('CRITICAL'));
        assert.ok(bands.has('NEEDS_REVIEW'));
    });
    (0, node_test_1.it)('getDemoWorkspace() returns all agents and unique verticals', () => {
        const w = (0, demo_workspace_1.getDemoWorkspace)();
        assert.equal(w.agents.length, demo_workspace_1.DEMO_AGENTS.length);
        assert.ok(w.verticals.length >= 8);
    });
    (0, node_test_1.it)('getDemoWorkspace({ vertical: "healthcare" }) filters correctly', () => {
        const w = (0, demo_workspace_1.getDemoWorkspace)({ vertical: 'healthcare' });
        assert.ok(w.agents.length > 0);
        assert.ok(w.agents.every((a) => a.vertical === 'healthcare'));
    });
    (0, node_test_1.it)('demo includes representative frameworks', () => {
        const frameworks = new Set(demo_workspace_1.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