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 { renderHook, act } from '@testing-library/react';
import { useScrollToFocusItem } from './useScrollToFocusItem';
describe('useScrollToFocusItem hook test', function () {
    it('should correctly call scrollToItem when focus move to down of list', function () {
        var scrollToItem = jest.fn();
        var initialProps = {
            items: new Array(15).fill(0),
            focusIndex: null,
            listRef: { current: { scrollToItem: scrollToItem } }
        };
        var _a = renderHook(useScrollToFocusItem, { initialProps: initialProps }), result = _a.result, rerender = _a.rerender;
        act(function () {
            result.current.handleOnItemsRendered({ visibleStartIndex: 0, visibleStopIndex: 5 });
        });
        rerender(__assign(__assign({}, initialProps), { focusIndex: 4 }));
        expect(scrollToItem).toHaveBeenCalledWith(7, 'end');
    });
    it('should correctly call scrollToItem when focus move to up of list', function () {
        var scrollToItem = jest.fn();
        var initialProps = {
            items: new Array(15).fill(0),
            focusIndex: null,
            listRef: { current: { scrollToItem: scrollToItem } }
        };
        var _a = renderHook(useScrollToFocusItem, { initialProps: initialProps }), result = _a.result, rerender = _a.rerender;
        act(function () {
            result.current.handleOnItemsRendered({ visibleStartIndex: 10, visibleStopIndex: 15 });
        });
        rerender(__assign(__assign({}, initialProps), { focusIndex: 11 }));
        expect(scrollToItem).toHaveBeenCalledWith(8, 'start');
    });
});
