import { fireEvent, render, screen } from '@testing-library/react';
import { ChatbotHeaderNewChatButton } from './ChatbotHeaderNewChatButton';
import '@testing-library/jest-dom';
describe('ChatbotHeaderNewChatButton', () => {
it('should render ChatbotHeaderNewChatButton', () => {
const { container } = render(
);
expect(container.querySelector('.custom-header-new-chat-button')).toBeTruthy();
});
it('should call onClick handler when new chat button is pressed', () => {
const onClick = jest.fn();
render();
fireEvent.click(screen.getByRole('button', { name: 'New chat' }));
expect(onClick).toHaveBeenCalled();
});
it('should render button with isCompact', () => {
render();
expect(screen.getByTestId('new-chat-button')).toHaveClass('pf-m-compact');
});
});