diff --git a/test/short-urls/helpers/ShortUrlFormCheckboxGroup.test.tsx b/test/short-urls/helpers/ShortUrlFormCheckboxGroup.test.tsx index aa564849..ec3276d0 100644 --- a/test/short-urls/helpers/ShortUrlFormCheckboxGroup.test.tsx +++ b/test/short-urls/helpers/ShortUrlFormCheckboxGroup.test.tsx @@ -1,17 +1,17 @@ -import { shallow } from 'enzyme'; +import { render, screen } from '@testing-library/react'; import { ShortUrlFormCheckboxGroup } from '../../../src/short-urls/helpers/ShortUrlFormCheckboxGroup'; -import { Checkbox } from '../../../src/utils/Checkbox'; -import { InfoTooltip } from '../../../src/utils/InfoTooltip'; describe('', () => { it.each([ [undefined, '', 0], ['This is the tooltip', 'me-2', 1], ])('renders tooltip only when provided', (infoTooltip, expectedClassName, expectedAmountOfTooltips) => { - const wrapper = shallow(); - const checkbox = wrapper.find(Checkbox); + render(); - expect(checkbox.prop('className')).toEqual(expectedClassName); - expect(wrapper.find(InfoTooltip)).toHaveLength(expectedAmountOfTooltips); + expect(screen.getByRole('checkbox').parentNode).toHaveAttribute( + 'class', + expect.stringContaining(expectedClassName), + ); + expect(screen.queryAllByRole('img', { hidden: true })).toHaveLength(expectedAmountOfTooltips); }); });