"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const dead_code_detector_1 = require("../dead-code-detector");
describe('DeadCodeDetector', () => {
    let detector;
    beforeEach(() => {
        detector = new dead_code_detector_1.DeadCodeDetector();
    });
    test('detects unused function', () => {
        const code = 'function unusedHelper() { return 1; }\nconst x = 1;';
        const reports = detector.detectUnusedFunctions(code, 'test.ts');
        expect(reports.some((r) => r.name === 'unusedHelper')).toBe(true);
    });
    test('skips exported functions', () => {
        const code = 'export function usedHelper() { return 1; }\nconst x = usedHelper();';
        const reports = detector.detectUnusedFunctions(code, 'test.ts');
        expect(reports.some((r) => r.name === 'usedHelper')).toBe(false);
    });
    test('detects unused import', () => {
        const code = "import { unused } from './module';\nconst x = 1;";
        const reports = detector.detectUnusedImports(code, 'test.ts');
        expect(reports.some((r) => r.name === 'unused')).toBe(true);
    });
    test('skips used imports', () => {
        const code = "import { used } from './module';\nconst x = used();";
        const reports = detector.detectUnusedImports(code, 'test.ts');
        expect(reports.some((r) => r.name === 'used')).toBe(false);
    });
    test('detectAll combines all reports', () => {
        const code = "import { unused } from './mod';\nfunction dead() {}\nconst x = 1;";
        const reports = detector.detectAll(code, 'test.ts');
        expect(reports.length).toBeGreaterThan(0);
    });
    test('getCleanAllAction formats correctly', () => {
        const code = "import { unused } from './mod';\nfunction dead() {}\nconst x = 1;";
        const reports = detector.detectAll(code, 'test.ts');
        const action = detector.getCleanAllAction(reports);
        expect(action).toContain('Remove');
    });
});
//# sourceMappingURL=dead-code-detector.test.js.map