import React from 'react'; import { render, screen } from '@testing-library/react'; import { AlertActionLink } from '../AlertActionLink'; jest.mock('../../Button'); test('Renders without children', () => { render(
); expect(screen.getByTestId('container').firstChild).toBeVisible(); }); test('Renders children', () => { render(Test); expect(screen.getByRole('button')).toBeVisible(); }); test('Renders ReactNode as children', () => { render(
Learn More
); expect(screen.getByText('Learn More')).toBeVisible(); }); test('Renders with custom class names provided via prop', () => { render(Test); expect(screen.getByRole('button')).toHaveClass('custom-class'); }); test('Renders with inherited element props spread to the component', () => { render(Test); expect(screen.getByRole('button')).toHaveAccessibleName('Test label'); }); test('Renders a Button with variant: ButtonVariant.link', () => { render(Test); expect(screen.getByText('variant: link')).toBeVisible(); }); test('Renders a Button with isInline: true', () => { render(Test); expect(screen.getByText('isInline: true')).toBeVisible(); }); test('Matches the snapshot', () => { const { asFragment } = render(Test); expect(asFragment()).toMatchSnapshot(); });