diff --git a/src/common-components/loading-modal/loading-modal.spec.js b/src/common-components/loading-modal/loading-modal.spec.js index e69de29b..6367c22c 100644 --- a/src/common-components/loading-modal/loading-modal.spec.js +++ b/src/common-components/loading-modal/loading-modal.spec.js @@ -0,0 +1,30 @@ +import { shallowMount } from "@vue/test-utils"; +import loadingModal from "./loading-modal"; +import { getMountOptions } from "@/helpers/unit-test-helper.js"; + +jest.mock("@/assets/img/loader.gif", () => "loader.gif"); +jest.mock("@/assets/img/windshield.png", () => "windshield.png"); + +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(); + }); +}); + +function setupMocks() { + + const mountOptions = getMountOptions({ + }); + + const wrapper = shallowMount(loadingModal, mountOptions); + return { wrapper }; +}