"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("@testing-library/react");
require("@testing-library/jest-dom");
const ChatbotWelcomePrompt_1 = __importDefault(require("./ChatbotWelcomePrompt"));
const user_event_1 = __importDefault(require("@testing-library/user-event"));
describe('ChatbotWelcomePrompt', () => {
    it('should render welcome prompt', () => {
        const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(ChatbotWelcomePrompt_1.default, { title: "Hi, ChatBot User!", description: "How can I help you today?" }));
        expect(container).toMatchSnapshot();
    });
    it('should render correctly', () => {
        (0, react_1.render)((0, jsx_runtime_1.jsx)(ChatbotWelcomePrompt_1.default, { title: "Hi, ChatBot User!", description: "How can I help you today?" }));
        expect(react_1.screen.getByText('Hi, ChatBot User!')).toBeTruthy();
        expect(react_1.screen.getByText('How can I help you today?')).toBeTruthy();
    });
    it('should render prompts with titles correctly', () => {
        (0, react_1.render)((0, jsx_runtime_1.jsx)(ChatbotWelcomePrompt_1.default, { title: "Hi, ChatBot User!", description: "How can I help you today?", prompts: [{ title: 'Set up account' }] }));
        expect(react_1.screen.getByText('Set up account')).toBeTruthy();
    });
    it('should render prompts with messages correctly', () => {
        (0, react_1.render)((0, jsx_runtime_1.jsx)(ChatbotWelcomePrompt_1.default, { title: "Hi, ChatBot User!", description: "How can I help you today?", prompts: [
                { title: 'Set up account', message: 'Choose the necessary settings and preferences for your account.' }
            ] }));
        expect(react_1.screen.getByText('Choose the necessary settings and preferences for your account.')).toBeTruthy();
    });
    it('should render prompts with onClick correctly', () => __awaiter(void 0, void 0, void 0, function* () {
        const spy = jest.fn();
        (0, react_1.render)((0, jsx_runtime_1.jsx)(ChatbotWelcomePrompt_1.default, { title: "Hi, ChatBot User!", description: "How can I help you today?", prompts: [
                {
                    title: 'Set up account',
                    message: 'Choose the necessary settings and preferences for your account.',
                    onClick: spy
                }
            ] }));
        yield user_event_1.default.click(react_1.screen.getByRole('button', { name: /Set up account/i }));
        expect(spy).toHaveBeenCalled();
    }));
    it('should apply className appropriately', () => {
        (0, react_1.render)((0, jsx_runtime_1.jsx)(ChatbotWelcomePrompt_1.default, { title: "Hi, ChatBot User!", description: "How can I help you today?", className: "test", testId: "welcome-prompt" }));
        const element = react_1.screen.getByTestId('welcome-prompt');
        expect(element).toHaveClass('test');
    });
    it('should handle isCompact', () => {
        (0, react_1.render)((0, jsx_runtime_1.jsx)(ChatbotWelcomePrompt_1.default, { title: "Hi, ChatBot User!", description: "How can I help you today?", className: "test", testId: "welcome-prompt", isCompact: true }));
        expect(react_1.screen.getByTestId('welcome-prompt')).toHaveClass('pf-m-compact');
    });
});
