import { createRef } from 'react' import { describe, test, expect } from 'vitest' import { render, screen } from '@testing-library/react' import { ChatAgentMessage } from './chat-agent-message' import { ChatLoader } from '../feedback/chat-loader' import { ChatThinking } from '../feedback/chat-thinking' describe('ChatAgentMessage', () => { test('renders text as child', () => { render(Agent response) expect(screen.getByText('Agent response')).toBeTruthy() }) test('forwards ref to the underlying element', () => { const ref = createRef() render(Agent response) expect(ref.current).toBeInstanceOf(HTMLElement) }) test('renders ChatLoader as child', () => { const { container } = render( , ) expect(container.querySelector('[role="status"]')).toBeTruthy() }) test('renders ChatThinking as child', () => { render( Processing... , ) expect(screen.getByText('Processing...')).toBeTruthy() }) test('renders string children verbatim (no markdown)', () => { render({'Some **bold** text'}) expect(screen.getByText('Some **bold** text')).toBeTruthy() }) })