"use strict";
/**
 * RED-GREEN tests for the onboarding tier router (W5.1-support).
 *
 * @connexum/ai-governance  F-NEW-PRODUCT-NON-TECH-ONBOARDING-LADDER
 */
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 onboarding_tier_router_1 = require("./onboarding-tier-router");
const profile = (over = {}) => ({
    techTeamSize: 3,
    cloudLlmOnly: false,
    vertical: 'devtools',
    agentCount: 5,
    regulated: false,
    hasMspPartner: false,
    wantsFullyManaged: false,
    ...over,
});
(0, node_test_1.describe)('onboarding tier router (W5.1)', () => {
    (0, node_test_1.it)('Tier E: wantsFullyManaged trumps everything else', () => {
        const r = (0, onboarding_tier_router_1.recommendOnboardingTier)(profile({ wantsFullyManaged: true, regulated: true }));
        assert.equal(r.tier, 'E');
        assert.match(r.label, /Compliance-as-a-Service/);
        assert.ok(r.alternatives.some((a) => a.tier === 'D'));
        assert.match(r.cta, /managed dashboard/);
    });
    (0, node_test_1.it)('Tier D: regulated + existing MSP partner', () => {
        const r = (0, onboarding_tier_router_1.recommendOnboardingTier)(profile({ regulated: true, hasMspPartner: true, techTeamSize: 4 }));
        assert.equal(r.tier, 'D');
        assert.match(r.cta, /MSP/);
        assert.ok(r.alternatives.some((a) => a.tier === 'C'));
    });
    (0, node_test_1.it)('Tier A: cloud-LLM-only + at least one engineer', () => {
        const r = (0, onboarding_tier_router_1.recommendOnboardingTier)(profile({ cloudLlmOnly: true, techTeamSize: 2, regulated: false }));
        assert.equal(r.tier, 'A');
        assert.match(r.cta, /one URL change/);
        assert.ok(r.alternatives.some((a) => a.tier === 'C'));
    });
    (0, node_test_1.it)('Tier A includes MSP alternative for fleets of 50+ agents', () => {
        const r = (0, onboarding_tier_router_1.recommendOnboardingTier)(profile({ cloudLlmOnly: true, techTeamSize: 2, agentCount: 75 }));
        assert.equal(r.tier, 'A');
        assert.ok(r.alternatives.some((a) => a.tier === 'D'));
    });
    (0, node_test_1.it)('Tier B: zero tech team + small agent footprint', () => {
        const r = (0, onboarding_tier_router_1.recommendOnboardingTier)(profile({ techTeamSize: 0, agentCount: 2 }));
        assert.equal(r.tier, 'B');
        assert.match(r.cta, /Chrome extension/);
    });
    (0, node_test_1.it)('Tier C: mid-market tech team with tool-using agents', () => {
        const r = (0, onboarding_tier_router_1.recommendOnboardingTier)(profile({ techTeamSize: 5, cloudLlmOnly: false, agentCount: 12 }));
        assert.equal(r.tier, 'C');
        assert.match(r.cta, /customer success/);
        assert.ok(r.alternatives.some((a) => a.tier === 'A'));
    });
    (0, node_test_1.it)('Tier D fallback: large team (>10)', () => {
        const r = (0, onboarding_tier_router_1.recommendOnboardingTier)(profile({ techTeamSize: 15, cloudLlmOnly: false, regulated: false }));
        assert.equal(r.tier, 'D');
        assert.ok(r.alternatives.some((a) => a.tier === 'E'));
    });
    (0, node_test_1.it)('Tier D fallback: regulated org without MSP partner', () => {
        const r = (0, onboarding_tier_router_1.recommendOnboardingTier)(profile({ techTeamSize: 0, cloudLlmOnly: false, regulated: true }));
        assert.equal(r.tier, 'D');
        assert.match(r.reasoning.join(' '), /Regulated/);
    });
    (0, node_test_1.it)('reasoning is non-empty for every recommendation', () => {
        const profiles = [
            profile({ wantsFullyManaged: true }),
            profile({ regulated: true, hasMspPartner: true }),
            profile({ cloudLlmOnly: true }),
            profile({ techTeamSize: 0, agentCount: 1 }),
            profile({ techTeamSize: 5 }),
            profile({ techTeamSize: 20 }),
        ];
        for (const p of profiles) {
            const r = (0, onboarding_tier_router_1.recommendOnboardingTier)(p);
            assert.ok(r.reasoning.length > 0, `${r.tier} should explain itself`);
            assert.ok(r.cta.length > 0);
        }
    });
    (0, node_test_1.it)('cta and label match the recommended tier', () => {
        const tiers = [
            { profile: profile({ wantsFullyManaged: true }), expected: 'as-a-Service' },
            { profile: profile({ regulated: true, hasMspPartner: true }), expected: 'MSP' },
            { profile: profile({ cloudLlmOnly: true, techTeamSize: 2 }), expected: 'Proxy' },
            { profile: profile({ techTeamSize: 0, agentCount: 1 }), expected: 'Browser' },
            { profile: profile({ techTeamSize: 5 }), expected: 'CSM' },
        ];
        for (const t of tiers) {
            const r = (0, onboarding_tier_router_1.recommendOnboardingTier)(t.profile);
            assert.match(r.label + ' ' + r.cta, new RegExp(t.expected, 'i'));
        }
    });
    (0, node_test_1.it)('alternatives are never empty', () => {
        const profiles = [
            profile(),
            profile({ wantsFullyManaged: true }),
            profile({ cloudLlmOnly: true }),
            profile({ regulated: true, hasMspPartner: true }),
        ];
        for (const p of profiles) {
            const r = (0, onboarding_tier_router_1.recommendOnboardingTier)(p);
            assert.ok(r.alternatives.length > 0, `${r.tier} should have at least one alternative`);
        }
    });
});
//# sourceMappingURL=onboarding-tier-router.test.js.map