"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var react_hooks_1 = require("@testing-library/react-hooks");
var core_1 = require("@react-sigma/core");
var useFakeCenterNode_1 = require("./useFakeCenterNode");
var defaultGraph_test_data_1 = require("./defaultGraph.test-data");
jest.mock('@react-sigma/core', function () { return ({
    useSigma: jest.fn()
}); });
describe('useFakeCenterNode tests', function () {
    var graph, sigmaGraph;
    var setUp = function () {
        graph = (0, defaultGraph_test_data_1.createDefaultGraph)();
        return (0, react_hooks_1.renderHook)(useFakeCenterNode_1.useFakeCenterNode, {
            initialProps: { graph: graph, timeout: 1000 }
        });
    };
    var sigma = {
        getGraph: jest.fn(function () { return sigmaGraph; })
    };
    beforeEach(function () {
        core_1.useSigma.mockReturnValue(sigma);
    });
    afterEach(function () {
        jest.clearAllMocks();
    });
    it('should add fake center node and edges on mount and drop it after timeout', function () {
        jest.useFakeTimers();
        setUp();
        expect(graph.hasNode(useFakeCenterNode_1.FAKE_CENTER_NODE_ID)).toBe(true);
        sigmaGraph = graph.copy();
        (0, react_hooks_1.act)(function () {
            jest.advanceTimersByTime(1000);
        });
        expect(graph.hasNode(useFakeCenterNode_1.FAKE_CENTER_NODE_ID)).toBe(false);
        jest.useRealTimers();
    });
});
