import { render } from '@react-email/render'; import { Section } from './index.js'; describe('
component', () => { it('renders correctly', async () => { const actualOutput = await render(
Lorem ipsum
); expect(actualOutput).toMatchInlineSnapshot( `"
Lorem ipsum
"`, ); }); it('renders children correctly', async () => { const testMessage = 'Test message'; const html = await render(
{testMessage}
); expect(html).toContain(testMessage); }); it('passes style and other props correctly', async () => { const style = { backgroundColor: 'red' }; const html = await render(
Test
, ); expect(html).toContain('style="background-color:red"'); expect(html).toContain('data-testid="section-test"'); }); it('renders with wrapper if no is provided', async () => { const actualOutput = await render(
Lorem ipsum
, ); expect(actualOutput).toContain(''); }); it('renders with wrapper if is provided', async () => { const actualOutput = await render(
Lorem ipsum
, ); expect(actualOutput).toContain(''); }); it('renders wrapping any child provided in a tag', async () => { const actualOutput = await render(
Lorem ipsum

Lorem ipsum

Lorem
, ); const tdChildrenArr = actualOutput.match(/.*?<\/td>/g); expect(tdChildrenArr).toHaveLength(1); }); });