var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
import React from 'react';
import { render, act } from '@testing-library/react';
import { mockResizeObserver } from 'jsdom-testing-mocks';
import { useSigma } from '@react-sigma/core';
import { SigmaGraphResizer } from './SigmaGraphResizer';
jest.mock('@react-sigma/core', function () { return (__assign(__assign({}, jest.requireActual('@react-sigma/core')), { useSigma: jest.fn().mockReturnValue({
        refresh: jest.fn()
    }) })); });
var setUp = function () { return render(React.createElement(SigmaGraphResizer, null)); };
var resizeObserver = mockResizeObserver();
describe('SigmaGraphResizer behavior', function () {
    it('should refresh sigma instance on resize', function () {
        var container = setUp().container;
        expect(useSigma().refresh).not.toHaveBeenCalled();
        resizeObserver.mockElementSize(container, {
            contentBoxSize: { inlineSize: 100, blockSize: 100 }
        });
        act(function () {
            resizeObserver.resize();
        });
        expect(useSigma().refresh).toHaveBeenCalled();
    });
});
