From 5eb899c0803849d7864c5de4877a2c79b0df7750 Mon Sep 17 00:00:00 2001 From: Kulbhushan Kaushik Date: Tue, 1 Nov 2022 11:45:00 -0400 Subject: [PATCH] commit --- .../make-question/make-question.spec.js | 28 +++++-------------- src/layouts/vehicle-make/vehicle-make.spec.js | 2 +- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/layouts/vehicle-make/make-question/make-question.spec.js b/src/layouts/vehicle-make/make-question/make-question.spec.js index c9e096e5..af0063df 100644 --- a/src/layouts/vehicle-make/make-question/make-question.spec.js +++ b/src/layouts/vehicle-make/make-question/make-question.spec.js @@ -1,14 +1,8 @@ import makeQuestion from "@/layouts/vehicle-make/make-question/make-question"; import { shallowMount } from "@vue/test-utils"; import { getMountOptions } from "@/helpers/unit-test-helper.js"; -import store from "@/store"; -jest.mock( - "@/store", - () => { - return {}; - }, - { virtual: true } -); +import { useMainStore } from "@/store"; + describe("make-question.vue", () => { @@ -57,23 +51,15 @@ function setupMocks({ dataFromStoreApi = [], }) { //Mock store - store.getVehicleMakes = jest.fn(() => dataFromStoreApi); - const mountOptions = getMountOptions({ - store: { - getVehicleMakes: store.getVehicleMakes, - }, - }); + const mountOptions = getMountOptions(); + + const store = useMainStore(); + store.getVehicleMakes = jest.fn(() => dataFromStoreApi); + - //Mock props - const mockMixin = { - methods: { - getCmsContent: jest.fn() - } - } mountOptions.propsData = { modelValue: modelValueProp, }; - mountOptions.mixins = [mockMixin]; const wrapper = shallowMount(makeQuestion, mountOptions); //Mock CMS content diff --git a/src/layouts/vehicle-make/vehicle-make.spec.js b/src/layouts/vehicle-make/vehicle-make.spec.js index 0bc25d0c..e205921d 100644 --- a/src/layouts/vehicle-make/vehicle-make.spec.js +++ b/src/layouts/vehicle-make/vehicle-make.spec.js @@ -21,7 +21,7 @@ jest.mock("@/helpers/layout-helper.js", () => ({ })); describe("vehicle-make.vue", () => { - test("Make question component is initized with api data", async (done) => { + test("Make question component is initized with api data", async () => { //Arrange const makeQuestionInitialData = ["honda", "ford", "dodge"]; const { wrapper, apiPromise } = setupMocks({