import { render, screen } from '@testing-library/react';
import { CardTitle } from '../CardTitle';
test('Renders with custom class when passed', () => {
render(text);
expect(screen.getByText('text')).toHaveClass('extra-class');
});
test('Does not render with card subtitle by default', () => {
render(text);
expect(screen.queryByText('text')?.nextElementSibling).not.toBeInTheDocument();
});
test('Renders with card subtitle when subtitle is passed', () => {
render(text);
expect(screen.getByText('subtitle content')).toBeInTheDocument();
});
test('extra props are spread to the root element', () => {
const testId = 'card-header';
render();
expect(screen.getByTestId(testId)).toBeInTheDocument();
});
test('Matches snapshot', () => {
const { asFragment } = render(text);
expect(asFragment()).toMatchSnapshot();
});