import { Button } from '..'; import { render, screen, within } from '../test-utils'; import ListItem from '.'; describe('ListItem', () => { it('shows the title and description', async () => { render(); const listItem = await findListItem(); expect(listItem).toHaveClass('np-list-item'); expect(within(listItem).getByText('Some title')).toBeInTheDocument(); expect(within(listItem).getByText('Some description')).toBeInTheDocument(); }); it('shows an action', async () => { render( Copy } />, ); const listItem = await findListItem(); const actionButton = await within(listItem).findByRole('button', { name: 'Copy' }); expect(actionButton).toBeInTheDocument(); }); it('shows media icon', async () => { render( } />, ); const listItem = await findListItem(); expect(within(listItem).getByAltText('icon')).toBeInTheDocument(); }); const findListItem = async () => screen.findByRole('listitem'); });