commit
This commit is contained in:
parent
badbece45c
commit
5eb899c080
2 changed files with 8 additions and 22 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Reference in a new issue