import { UIView } from '@uirouter/react'; import { render } from '@testing-library/react'; import { withTestRouter } from '@/react/test-utils/withRouter'; import { AddButton } from './AddButton'; function renderDefault({ label = 'default label', }: Partial<{ label: string }> = {}) { const Wrapped = withTestRouter(AddButton, { stateConfig: [ { name: 'root', url: '/', component: () => ( <>
Root
), }, { name: 'root.new', url: 'new', }, ], route: 'root', }); return render( {label} ); } test('should display a AddButton component', async () => { const label = 'test label'; const { findByText } = renderDefault({ label }); const buttonLabel = await findByText(label); expect(buttonLabel).toBeTruthy(); });