var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
import React from 'react';
import { render, screen } from '@testing-library/react';
import '@testing-library/jest-dom';
import JumpButton from './JumpButton';
import userEvent from '@testing-library/user-event';
describe('JumpButton', () => {
    it('should render top button correctly', () => {
        render(React.createElement(JumpButton, { position: "top", onClick: jest.fn() }));
        expect(screen.getByRole('button', { name: /Jump top/i })).toBeTruthy();
    });
    it('should render bottom button correctly', () => {
        render(React.createElement(JumpButton, { position: "bottom", onClick: jest.fn() }));
        expect(screen.getByRole('button', { name: /Jump bottom/i })).toBeTruthy();
    });
    it('should call onClick appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
        const spy = jest.fn();
        render(React.createElement(JumpButton, { position: "bottom", onClick: spy }));
        yield userEvent.click(screen.getByRole('button', { name: /Jump bottom/i }));
        expect(spy).toHaveBeenCalledTimes(1);
    }));
    it('should be hidden if isHidden prop is used', () => __awaiter(void 0, void 0, void 0, function* () {
        render(React.createElement(JumpButton, { position: "bottom", onClick: jest.fn(), isHidden: true }));
        expect(screen.queryByRole('button', { name: /Jump bottom/i })).toBeFalsy();
    }));
});
