"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const duplication_detector_1 = require("../duplication-detector");
describe('DuplicationDetector', () => {
    let detector;
    beforeEach(() => {
        detector = new duplication_detector_1.DuplicationDetector(3, 0.6);
    });
    test('detects clones between two files', () => {
        const files = {
            'a.ts': 'function foo() {\n  const x = 1;\n  return x;\n}',
            'b.ts': 'function bar() {\n  const x = 1;\n  return x;\n}',
        };
        const groups = detector.detectClones(files);
        expect(groups.length).toBeGreaterThan(0);
    });
    test('no clones for completely different code', () => {
        const files = {
            'a.ts': 'const a = 1;\nconst b = 2;\nconst c = 3;',
            'b.ts': 'const x = 9;\nconst y = 8;\nconst z = 7;',
        };
        const groups = detector.detectClones(files);
        expect(groups).toHaveLength(0);
    });
    test('getExtractHelperAction returns string', () => {
        const files = {
            'a.ts': 'function foo() {\n  const x = 1;\n  return x;\n}',
            'b.ts': 'function bar() {\n  const x = 1;\n  return x;\n}',
        };
        const groups = detector.detectClones(files);
        if (groups.length > 0) {
            expect(detector.getExtractHelperAction(groups[0])).toContain('Extract');
        }
    });
    test('getStats returns correct structure', () => {
        const files = {
            'a.ts': 'function foo() {\n  const x = 1;\n  return x;\n}',
            'b.ts': 'function bar() {\n  const x = 1;\n  return x;\n}',
        };
        const groups = detector.detectClones(files);
        const stats = detector.getStats(groups);
        expect(stats.totalGroups).toBeGreaterThanOrEqual(0);
        expect(stats.totalFiles).toBeGreaterThanOrEqual(0);
    });
});
//# sourceMappingURL=duplication-detector.test.js.map