"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ErrorPopup_1 = require("../ErrorPopup");
var errors_1 = require("./errors");
describe('showErrorMessage tests', function () {
    beforeAll(function () {
        jest.spyOn(ErrorPopup_1.ErrorPopup, 'addError').mockImplementation(function () { });
    });
    beforeEach(function () {
        jest.clearAllMocks();
    });
    it('should show ErrorPopup with correct props', function () {
        (0, errors_1.showErrorMessage)({
            errorMessage: 'Error message',
            errorCode: 123
        });
        expect(ErrorPopup_1.ErrorPopup.addError).toHaveBeenCalledWith({
            title: 'Error',
            message: 'Error message'
        });
    });
    it('should show custom default message if errorMessage is not provided', function () {
        (0, errors_1.showErrorMessage)({
            errorMessage: '',
            errorCode: 123
        }, { defaultMessage: 'Custom message' });
        expect(ErrorPopup_1.ErrorPopup.addError).toHaveBeenCalledWith({
            title: 'Error',
            message: 'Custom message'
        });
    });
    it('should show custom message if it is provided', function () {
        (0, errors_1.showErrorMessage)({
            errorMessage: 'Error message',
            errorCode: 123
        }, { message: 'Custom message' });
        expect(ErrorPopup_1.ErrorPopup.addError).toHaveBeenCalledWith({
            title: 'Error',
            message: 'Custom message'
        });
    });
    it('should show custom title if it is provided', function () {
        (0, errors_1.showErrorMessage)({
            errorMessage: 'Error message',
            errorCode: 123
        }, { title: 'Custom title' });
        expect(ErrorPopup_1.ErrorPopup.addError).toHaveBeenCalledWith({
            title: 'Custom title',
            message: 'Error message'
        });
    });
    describe('showDefaultErrorMessage tests', function () {
        it('should show default message if errorMessage is not provided', function () {
            (0, errors_1.showDefaultErrorMessage)({
                errorMessage: '',
                errorCode: 123
            });
            expect(ErrorPopup_1.ErrorPopup.addError).toHaveBeenCalledWith({
                title: 'Error',
                message: 'Something went wrong'
            });
        });
    });
});
