"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importDefault(require("react"));
const react_2 = require("@testing-library/react");
const PreviewAttachment_1 = require("./PreviewAttachment");
describe('PreviewAttachment', () => {
    it('should render PreviewAttachment', () => {
        (0, react_2.render)(react_1.default.createElement(PreviewAttachment_1.PreviewAttachment, { code: "Hello world", fileName: "greetings.txt", isModalOpen: true, onEdit: jest.fn(), handleModalToggle: jest.fn() }));
        expect(react_2.screen.getByText('Preview attachment')).toBeTruthy();
        expect(react_2.screen.getByText('greetings')).toBeTruthy();
        expect(react_2.screen.getAllByText('TEXT')).toBeTruthy();
    });
    it('should call onEdit handler when edit button is pressed', () => {
        const onEdit = jest.fn();
        (0, react_2.render)(react_1.default.createElement(PreviewAttachment_1.PreviewAttachment, { code: "Hello world", fileName: "greetings.txt", isModalOpen: true, onEdit: onEdit, handleModalToggle: jest.fn() }));
        react_2.fireEvent.click(react_2.screen.getByText('Edit'));
        expect(onEdit).toHaveBeenCalled();
    });
    it('should call onDismiss handler when dismiss button is pressed', () => {
        const onDismiss = jest.fn();
        (0, react_2.render)(react_1.default.createElement(PreviewAttachment_1.PreviewAttachment, { code: "Hello world", fileName: "greetings.txt", isModalOpen: true, onEdit: jest.fn(), handleModalToggle: onDismiss }));
        react_2.fireEvent.click(react_2.screen.getByText('Dismiss'));
        expect(onDismiss).toHaveBeenCalled();
    });
});
