import { shallowMount } from '@vue/test-utils';
import loadingModal from '@/iss-components/loading-modal/loading-modal.vue';
import { getMountOptions } from '@/helpers/unit-test-helper.js';

jest.mock('@/assets/img/loader.gif', () => 'loader.gif');
jest.mock('@/assets/img/windshield.png', () => 'windshield.png');

/** @ignore */
function setupMocks() {
    const mountOptions = getMountOptions({
    });

    const wrapper = shallowMount(loadingModal, mountOptions);
    return { wrapper };
}

describe('loadingModal', () => {
    test('showModal sets modal visible', async () => {
        // Arrange
        const { wrapper } = setupMocks();
        wrapper.vm.isModalVisible = false;

        // Act
        wrapper.vm.showModal();

        // Assert
        expect(wrapper.vm.isModalVisible).toEqual(true);
        wrapper.unmount();
    });
    test('hideModal sets modal invisible', async () => {
        // Arrange
        const { wrapper } = setupMocks();
        wrapper.vm.isModalVisible = true;

        // Act
        wrapper.vm.hideModal();

        // Assert
        expect(wrapper.vm.isModalVisible).toEqual(false);
        wrapper.unmount();
    });
});
