"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const circular_dependency_detector_1 = require("../circular-dependency-detector");
describe('CircularDependencyDetector', () => {
    let detector;
    beforeEach(() => {
        detector = new circular_dependency_detector_1.CircularDependencyDetector();
    });
    test('detects simple cycle', () => {
        const edges = [
            { from: 'A', to: 'B' },
            { from: 'B', to: 'A' },
        ];
        const graph = detector.buildGraph(edges);
        const cycles = detector.detectCycles(graph);
        expect(cycles.length).toBeGreaterThan(0);
    });
    test('no cycles in acyclic graph', () => {
        const edges = [
            { from: 'A', to: 'B' },
            { from: 'B', to: 'C' },
        ];
        const graph = detector.buildGraph(edges);
        const cycles = detector.detectCycles(graph);
        expect(cycles).toHaveLength(0);
    });
    test('finds break point', () => {
        const edges = [
            { from: 'A', to: 'B' },
            { from: 'B', to: 'C' },
            { from: 'C', to: 'A' },
        ];
        const graph = detector.buildGraph(edges);
        const cycles = detector.detectCycles(graph);
        expect(cycles[0].breakPoint).toBeDefined();
    });
    test('generates DOT visualization', () => {
        const edges = [{ from: 'A', to: 'B' }];
        const graph = detector.buildGraph(edges);
        const dot = detector.generateGraphVisualization(graph);
        expect(dot).toContain('digraph');
        expect(dot).toContain('"A" -> "B"');
    });
    test('getStats returns correct structure', () => {
        const edges = [
            { from: 'A', to: 'B' },
            { from: 'B', to: 'A' },
        ];
        const graph = detector.buildGraph(edges);
        const cycles = detector.detectCycles(graph);
        const stats = detector.getStats(cycles);
        expect(stats.totalCycles).toBeGreaterThan(0);
    });
});
//# sourceMappingURL=circular-dependency-detector.test.js.map