"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ab_test_framework_1 = require("../../walls/03-knowledge/decisions/ab-test-framework");
describe('ABTestFramework', () => {
    let framework;
    beforeEach(() => {
        framework = new ab_test_framework_1.ABTestFramework();
    });
    test('creates A/B test', () => {
        const test = framework.createTest('UI Experiment', 10, 10);
        expect(test.controlGroup).toHaveLength(10);
        expect(test.experimentGroup).toHaveLength(10);
    });
    test('records predictions and computes accuracy', () => {
        const test = framework.createTest('Test', 5, 5);
        framework.recordPrediction(test.id, 'p1', true, 'control');
        framework.recordPrediction(test.id, 'p2', false, 'control');
        framework.recordPrediction(test.id, 'p3', true, 'experiment');
        framework.recordPrediction(test.id, 'p4', true, 'experiment');
        expect(framework.getAccuracy(test.id, 'control')).toBe(0.5);
        expect(framework.getAccuracy(test.id, 'experiment')).toBe(1);
    });
    test('computeSignificance returns not significant with low samples', () => {
        const test = framework.createTest('Small', 5, 5);
        framework.recordPrediction(test.id, 'p1', true, 'control');
        framework.recordPrediction(test.id, 'p2', true, 'experiment');
        const result = framework.computeSignificance(test.id);
        expect(result.isSignificant).toBe(false);
    });
    test('getAllTests returns all tests', () => {
        framework.createTest('A', 5, 5);
        framework.createTest('B', 5, 5);
        expect(framework.getAllTests()).toHaveLength(2);
    });
    test('getStats returns correct structure', () => {
        const test = framework.createTest('Stats', 5, 5);
        framework.recordPrediction(test.id, 'p1', true, 'control');
        const stats = framework.getStats(test.id);
        expect(stats.controlAccuracy).toBe(1);
        expect(stats.totalPredictions).toBe(1);
    });
});
//# sourceMappingURL=ab-test-framework.test.js.map