import { render } from '@testing-library/react'; import { Tbody } from './Tbody'; import { expect, describe, it } from 'vitest'; describe('Tbody component', () => { it('renders the component with the correct props and children', () => { const testClass = 'test-class'; const testContent = 'Test content'; const { getByRole, getByText } = render(
{testContent} ); const tbodyElement = getByRole('rowgroup'); expect(tbodyElement).toHaveClass('lunatic-table-tbody'); expect(tbodyElement).toHaveClass(testClass); expect(getByText(testContent)).toBeInTheDocument(); }); it('renders the component without an ID or class when not provided', () => { const { getByRole } = render(); const tbodyElement = getByRole('rowgroup'); expect(tbodyElement).not.toHaveAttribute('id'); expect(tbodyElement).toHaveClass('lunatic-table-tbody'); }); });