"use strict";
describe('aggregatePatterns trust score (Unit 1.2.1)', () => {
    test('weighted average prevents low-trust patterns from dragging down high-trust ones', () => {
        const highTrustPattern = {
            type: 'style_quotes',
            value: 'single',
            count: 100,
            trustScore: 90,
            category: 'style',
            filePath: '',
            language: '',
        };
        const lowTrustPattern = {
            type: 'style_quotes',
            value: 'single',
            count: 1,
            trustScore: 10,
            category: 'style',
            filePath: '',
            language: '',
        };
        const totalCount = highTrustPattern.count + lowTrustPattern.count;
        const expectedWeighted = Math.round((highTrustPattern.trustScore * highTrustPattern.count +
            lowTrustPattern.trustScore * lowTrustPattern.count) /
            totalCount);
        const naive = Math.round((highTrustPattern.trustScore + lowTrustPattern.trustScore) / 2);
        expect(naive).toBe(50);
        expect(expectedWeighted).toBeGreaterThan(85);
        expect(expectedWeighted).toBeLessThan(91);
    });
    test('weighted formula correctness: (90*100 + 10*1) / 101 ≈ 89.1 → 89', () => {
        const a = { trustScore: 90, count: 100 };
        const b = { trustScore: 10, count: 1 };
        const total = a.count + b.count;
        const result = Math.round((a.trustScore * a.count + b.trustScore * b.count) / total);
        expect(result).toBe(89);
    });
});
//# sourceMappingURL=code-scanner-trust-score.test.js.map