/**
 * Integration tests for command registry
 */
import { describe, it, expect } from "vitest";
import { COMMANDS, getCommand, listCommands } from "../../commands/index.js";
describe("Command Registry", () => {
    it("exports all expected commands", () => {
        const commandNames = Object.keys(COMMANDS);
        // Core commands (9)
        expect(commandNames).toContain("audit");
        expect(commandNames).toContain("fix-critical");
        expect(commandNames).toContain("fix-high");
        expect(commandNames).toContain("fix-medium");
        expect(commandNames).toContain("fix-rls");
        expect(commandNames).toContain("add-tests");
        expect(commandNames).toContain("verify");
        expect(commandNames).toContain("harden");
        expect(commandNames).toContain("preflight");
        // Audit commands (6)
        expect(commandNames).toContain("deps");
        expect(commandNames).toContain("deadcode");
        expect(commandNames).toContain("errors");
        expect(commandNames).toContain("secrets");
        expect(commandNames).toContain("api-check");
        expect(commandNames).toContain("perf");
        // Certification commands (7)
        expect(commandNames).toContain("certification-security");
        expect(commandNames).toContain("certification-reliability");
        expect(commandNames).toContain("certification-typesafety");
        expect(commandNames).toContain("certification-performance");
        expect(commandNames).toContain("certification-quality");
        expect(commandNames).toContain("certification-redteam");
        expect(commandNames).toContain("certify");
        // Total: 22 commands
        expect(commandNames.length).toBe(22);
    });
    it("getCommand returns correct command", () => {
        const audit = getCommand("audit");
        expect(audit).toBeDefined();
        expect(audit?.name).toBe("audit");
        expect(audit?.description).toContain("production readiness audit");
        expect(audit?.content).toContain("AUDIT.md");
        const certify = getCommand("certify");
        expect(certify).toBeDefined();
        expect(certify?.name).toBe("certify");
        expect(certify?.content).toContain("enterprise certification");
    });
    it("getCommand returns undefined for unknown command", () => {
        const unknown = getCommand("nonexistent-command");
        expect(unknown).toBeUndefined();
    });
    it("listCommands returns all commands", () => {
        const commands = listCommands();
        expect(commands.length).toBe(22);
        expect(commands.every((cmd) => cmd.name && cmd.description && cmd.content)).toBe(true);
    });
    it("each command has required fields", () => {
        for (const [name, command] of Object.entries(COMMANDS)) {
            expect(command.name).toBe(name.replace("certification-", "certification-"));
            expect(command.description).toBeTruthy();
            expect(command.description.length).toBeGreaterThan(10);
            expect(command.content).toBeTruthy();
            expect(command.content.length).toBeGreaterThan(100);
        }
    });
    it("core commands reference AUDIT.md or related files", () => {
        const audit = getCommand("audit");
        expect(audit?.content).toContain("AUDIT.md");
        const fixCritical = getCommand("fix-critical");
        expect(fixCritical?.content).toContain("AUDIT.md");
        expect(fixCritical?.content).toContain("CRITICAL");
        const verify = getCommand("verify");
        expect(verify?.content).toContain("HARDENING-REPORT.md");
    });
    it("certification commands reference agent tools", () => {
        const security = getCommand("certification-security");
        expect(security?.content).toContain("agent_submit_finding");
        expect(security?.content).toContain("agent_complete");
        const redteam = getCommand("certification-redteam");
        expect(redteam?.content).toContain("redteam_challenge");
        expect(redteam?.content).toContain("agent_cross_verify");
    });
    it("certify command references all phases", () => {
        const certify = getCommand("certify");
        expect(certify?.content).toContain("Phase 1:");
        expect(certify?.content).toContain("Phase 2:");
        expect(certify?.content).toContain("Phase 3:");
        expect(certify?.content).toContain("certification_start");
        expect(certify?.content).toContain("certification_consensus");
        expect(certify?.content).toContain("certification_finalize");
    });
});
//# sourceMappingURL=commands.test.js.map