import React from 'react' import { render, screen } from '@testing-library/react' import { Text } from './Text' describe('Text', () => { it('should render the content (string)', () => { render(Hello) expect(screen.getByText('Hello')).toBeInTheDocument() }) it('should render the content (ReactNode)', () => { const { container } = render( Yo , ) expect(container.innerHTML).toContain('Yo') }) it('should replace new lines with br if content is string', () => { const content = `Hello world how are you? ` const { container } = render({content}) const brNumber = (container.innerHTML.match(/
/g) || []).length expect(brNumber).toEqual(3) }) })