import { screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import { MemoryRouter } from 'react-router-dom'; import type { ShortUrl } from '../../../shlink-web-component/short-urls/data'; import { ShortUrlsRowMenu as createShortUrlsRowMenu } from '../../../shlink-web-component/short-urls/helpers/ShortUrlsRowMenu'; import type { ReachableServer } from '../../../src/servers/data'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { const ShortUrlsRowMenu = createShortUrlsRowMenu(() => DeleteShortUrlModal, () => QrCodeModal); const selectedServer = fromPartial({ id: 'abc123' }); const shortUrl = fromPartial({ shortCode: 'abc123', shortUrl: 'https://s.test/abc123', }); const setUp = () => renderWithEvents( , ); it('renders modal windows', () => { setUp(); expect(screen.getByText('DeleteShortUrlModal')).toBeInTheDocument(); expect(screen.getByText('QrCodeModal')).toBeInTheDocument(); }); it('renders correct amount of menu items', async () => { const { user } = setUp(); await user.click(screen.getByRole('button')); expect(screen.getAllByRole('menuitem')).toHaveLength(4); }); });