import React from 'react' import { render } from '@testing-library/react' import { vi } from 'vitest' import { type RichTextContentProps } from '../RichTextContent' import { EditableRichTextContent } from './EditableRichTextContent' const mockFn = vi.fn() vi.mock('../RichTextContent', () => ({ __esModule: true, RichTextContent: (props: RichTextContentProps): JSX.Element => { mockFn(props) return
Mocked Component
}, })) const content = [ { type: 'paragraph', content: [{ type: 'text', text: 'Sample rich text content' }], }, ] describe('Content props are passed', () => { it('should pass them to RichTextContent component', () => { render( , ) expect(mockFn).toHaveBeenCalledWith({ content, id: 'sampleId' }) }) })