import { fireEvent } from '@testing-library/react'; import { render } from '../../utils/theme-render-wrapper'; import { ASSETS_URL } from '../../consts/common'; import { TextWithIcon } from './text-with-icon'; const src = `${ASSETS_URL}/icons/icon_linux.svg`; const text = 'text'; describe('', () => { it('should render successfully and pass text and src', () => { const { queryByText } = render(); const textEl = queryByText(text); expect(textEl?.textContent).toBe(text); }); it('should truncate long text and show tooltip', async () => { const { queryByText, getByTestId, findByText } = render( ); const textEl = getByTestId('TextWithIcon'); fireEvent.mouseEnter(textEl); const tooltip = await findByText(text); expect(tooltip).toBeTruthy(); }); });