/**
 * Unit tests for action types module
 */
import { describe, it, expect } from "vitest";
import { SEVERITY_LEVELS, exceedsThreshold } from "./types.js";
describe("SEVERITY_LEVELS", () => {
    it("has correct severity ordering", () => {
        expect(SEVERITY_LEVELS.critical).toBeGreaterThan(SEVERITY_LEVELS.high);
        expect(SEVERITY_LEVELS.high).toBeGreaterThan(SEVERITY_LEVELS.medium);
        expect(SEVERITY_LEVELS.medium).toBeGreaterThan(SEVERITY_LEVELS.low);
        expect(SEVERITY_LEVELS.low).toBeGreaterThan(SEVERITY_LEVELS.info);
        expect(SEVERITY_LEVELS.info).toBeGreaterThan(SEVERITY_LEVELS.none);
    });
    it("none has value 0", () => {
        expect(SEVERITY_LEVELS.none).toBe(0);
    });
    it("critical has highest value", () => {
        expect(SEVERITY_LEVELS.critical).toBe(5);
    });
});
describe("exceedsThreshold", () => {
    const emptySeverities = {
        critical: 0,
        high: 0,
        medium: 0,
        low: 0,
        info: 0,
    };
    it("returns false when threshold is none", () => {
        const severities = { ...emptySeverities, critical: 5, high: 10 };
        expect(exceedsThreshold(severities, "none")).toBe(false);
    });
    it("returns false when no findings", () => {
        expect(exceedsThreshold(emptySeverities, "critical")).toBe(false);
        expect(exceedsThreshold(emptySeverities, "high")).toBe(false);
        expect(exceedsThreshold(emptySeverities, "medium")).toBe(false);
    });
    it("returns true when critical findings exceed critical threshold", () => {
        const severities = { ...emptySeverities, critical: 1 };
        expect(exceedsThreshold(severities, "critical")).toBe(true);
    });
    it("returns true when high findings exceed critical threshold", () => {
        // High is below critical threshold, so should NOT exceed
        const severities = { ...emptySeverities, high: 5 };
        expect(exceedsThreshold(severities, "critical")).toBe(false);
    });
    it("returns true when high findings exceed high threshold", () => {
        const severities = { ...emptySeverities, high: 3 };
        expect(exceedsThreshold(severities, "high")).toBe(true);
    });
    it("returns true when critical findings exceed high threshold", () => {
        // Critical is above high, so it exceeds high threshold
        const severities = { ...emptySeverities, critical: 1 };
        expect(exceedsThreshold(severities, "high")).toBe(true);
    });
    it("returns true when medium findings exceed medium threshold", () => {
        const severities = { ...emptySeverities, medium: 2 };
        expect(exceedsThreshold(severities, "medium")).toBe(true);
    });
    it("handles multiple severity levels", () => {
        const severities = {
            critical: 0,
            high: 2,
            medium: 5,
            low: 10,
            info: 20,
        };
        expect(exceedsThreshold(severities, "critical")).toBe(false);
        expect(exceedsThreshold(severities, "high")).toBe(true);
        expect(exceedsThreshold(severities, "medium")).toBe(true);
        expect(exceedsThreshold(severities, "low")).toBe(true);
        expect(exceedsThreshold(severities, "info")).toBe(true);
    });
    it("returns true for info threshold when info findings exist", () => {
        const severities = { ...emptySeverities, info: 1 };
        expect(exceedsThreshold(severities, "info")).toBe(true);
    });
});
//# sourceMappingURL=types.test.js.map