import { describe, it, expect, vi } from 'vitest' import { render } from '@testing-library/react' import { Markdown } from './markdown' import { Provider } from '../provider/widget-provider' vi.mock('./markdown-ui', () => ({ MarkdownUI: ({ content }: { content: string }) => (
{content}
), })) describe(' bridge', () => { it('forwards data.content from the store to MarkdownUI', () => { const { getByTestId } = render( , ) expect(getByTestId('md-ui').textContent).toBe('# hi\n\nbody') }) it('falls back to empty string when data is undefined', () => { const { getByTestId } = render( , ) expect(getByTestId('md-ui').textContent).toBe('') }) it('falls back to empty string when data.content is missing', () => { const { getByTestId } = render( , ) expect(getByTestId('md-ui').textContent).toBe('') }) })