"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const merge_conflict_predictor_1 = require("../../walls/03-knowledge/decisions/merge-conflict-predictor");
describe('MergeConflictPredictor', () => {
    let predictor;
    beforeEach(() => {
        predictor = new merge_conflict_predictor_1.MergeConflictPredictor();
    });
    test('detects same line edit conflict', () => {
        const diffA = '+++ b/src/app.ts\n@@ -1,1 +1,1 @@\n+const x = 1;';
        const diffB = '+++ b/src/app.ts\n@@ -1,1 +1,1 @@\n+const x = 2;';
        const conflicts = predictor.predictConflicts(diffA, diffB);
        expect(conflicts.length).toBeGreaterThan(0);
    });
    test('returns empty for non-overlapping diffs', () => {
        const diffA = '+++ b/src/a.ts\n@@ -1,1 +1,1 @@\n+const a = 1;';
        const diffB = '+++ b/src/b.ts\n@@ -1,1 +1,1 @@\n+const b = 2;';
        const conflicts = predictor.predictConflicts(diffA, diffB);
        expect(conflicts).toHaveLength(0);
    });
    test('applies user preference with low observation count', () => {
        const diffA = '+++ b/src/app.ts\n@@ -1,1 +1,1 @@\n+const x = 1;';
        const diffB = '+++ b/src/app.ts\n@@ -1,1 +1,1 @@\n+const x = 2;';
        const conflicts = predictor.predictConflicts(diffA, diffB, { preferBranchA: true });
        const adjusted = predictor.getUserPreferenceConfidence(conflicts, { preferBranchA: true }, 5);
        expect(adjusted[0].confidence).toBeLessThan(conflicts[0].confidence);
    });
    test('applies user preference with sufficient observations', () => {
        const diffA = '+++ b/src/app.ts\n@@ -1,1 +1,1 @@\n+const x = 1;';
        const diffB = '+++ b/src/app.ts\n@@ -1,1 +1,1 @@\n+const x = 2;';
        const conflicts = predictor.predictConflicts(diffA, diffB, { preferBranchA: true });
        const adjusted = predictor.getUserPreferenceConfidence(conflicts, { preferBranchA: true }, 10);
        expect(adjusted[0].suggestion).toContain('Branch A');
    });
});
//# sourceMappingURL=merge-conflict-predictor.test.js.map