import { describe, test, expect, vi } from 'vitest' import { render, screen, fireEvent } from '@testing-library/react' import { ChatActionsContainer } from './chat-actions-container' import { ChatRatingAction } from './chat-rating-action' describe('ChatActionsContainer', () => { test('renders children', () => { render( child content , ) expect(screen.getByText('child content')).toBeTruthy() }) }) describe('ChatRatingAction', () => { test('renders thumb up and thumb down buttons', () => { render() expect(screen.getByLabelText('Thumbs up')).toBeTruthy() expect(screen.getByLabelText('Thumbs down')).toBeTruthy() }) test('calls onRatingChange with up when thumbs up clicked', () => { const onRatingChange = vi.fn() render() fireEvent.click(screen.getByLabelText('Thumbs up')) expect(onRatingChange).toHaveBeenCalledWith('up') }) test('calls onRatingChange with null when active thumb up clicked', () => { const onRatingChange = vi.fn() render() fireEvent.click(screen.getByLabelText('Thumbs up')) expect(onRatingChange).toHaveBeenCalledWith(null) }) test('calls onRatingChange with down when thumbs down clicked', () => { const onRatingChange = vi.fn() render() fireEvent.click(screen.getByLabelText('Thumbs down')) expect(onRatingChange).toHaveBeenCalledWith('down') }) test('highlights active rating up', () => { const { container } = render() expect(container.querySelector('[data-testid="ThumbUpIcon"]')).toBeTruthy() }) test('highlights active rating down', () => { const { container } = render() expect( container.querySelector('[data-testid="ThumbDownIcon"]'), ).toBeTruthy() }) test('renders with custom labels', () => { render( , ) expect(screen.getByLabelText('Like')).toBeTruthy() expect(screen.getByLabelText('Dislike')).toBeTruthy() }) })