import { describe, test, expect } from 'vitest'
import { render, screen } from '@testing-library/react'
import { ChatToolCodeArea } from './chat-tool-code-area'

describe('ChatToolCodeArea', () => {
  test('renders code content', () => {
    render(<ChatToolCodeArea content='{"status": 200}' />)
    expect(screen.getByText('{"status": 200}')).toBeTruthy()
  })

  test('applies error styling via isError prop', () => {
    const { container } = render(
      <ChatToolCodeArea content='Error output' isError />,
    )
    const pre = container.querySelector('pre')
    expect(pre).toBeTruthy()
  })

  test('does not show Full view button when content fits', () => {
    render(<ChatToolCodeArea content='short' />)
    expect(screen.queryByText('Full view')).toBeNull()
  })
})
