From a0bcbce6f5b5ed42b47ec481913398bdb3afe844 Mon Sep 17 00:00:00 2001 From: Kulbhushan Kaushik Date: Wed, 23 Nov 2022 08:26:21 -0500 Subject: [PATCH] commit --- .../loading-modal/loading-modal.spec.js | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) 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 }; +}