"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ast_extractor_1 = require("../ast-extractor");
describe('DiffPatternMatcher', () => {
    let extractor;
    beforeEach(() => {
        extractor = new ast_extractor_1.DiffPatternMatcher();
    });
    test('detects type annotation addition', () => {
        const results = extractor.extract('function foo(x) { return x; }', 'function foo(x: string): string { return x; }');
        expect(results.some((r) => r.category === 'type_annotation')).toBe(true);
    });
    test('detects try/catch wrapping addition', () => {
        const results = extractor.extract('const data = await fetch(url);', 'try { const data = await fetch(url); } catch (e) { console.error(e); }');
        expect(results.some((r) => r.category === 'error_handling')).toBe(true);
    });
    test('detects null check addition', () => {
        const results = extractor.extract('return data.value;', 'if (data !== null) { return data.value; }');
        expect(results.some((r) => r.category === 'null_safety')).toBe(true);
    });
    test('detects import reorganization', () => {
        const results = extractor.extract("import React from 'react';\nimport { useState } from 'react';\nconst x = 1;", "import React, { useState } from 'react';\nconst x = 1;");
        expect(results.some((r) => r.category === 'import_organization')).toBe(true);
    });
    test('returns empty for identical code', () => {
        const results = extractor.extract('const x = 1', 'const x = 1');
        expect(results).toHaveLength(0);
    });
});
//# sourceMappingURL=ast-extractor.test.js.map