import { render } from '@testing-library/react'; import { Th } from './Th'; import { expect, describe, it } from 'vitest'; describe('', () => { const props = { index: 1, colSpan: 2, rowSpan: 3, className: 'test-class', children: 'test children', }; it('renders children', () => { const { getByRole } = render(
); expect(getByRole('columnheader')).toHaveTextContent(props.children); }); it('renders with correct attributes', () => { const { getByRole } = render(
); const th = getByRole('columnheader'); expect(th).toHaveAttribute('colSpan', props.colSpan.toString()); expect(th).toHaveAttribute('rowSpan', props.rowSpan.toString()); expect(th).toHaveClass(props.className); }); });