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 makeQuestion from "@/layouts/vehicle-make/make-question/make-question";
|
||||||
import { shallowMount } from "@vue/test-utils";
|
import { shallowMount } from "@vue/test-utils";
|
||||||
import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
||||||
import store from "@/store";
|
import { useMainStore } from "@/store";
|
||||||
jest.mock(
|
|
||||||
"@/store",
|
|
||||||
() => {
|
|
||||||
return {};
|
|
||||||
},
|
|
||||||
{ virtual: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
describe("make-question.vue", () => {
|
describe("make-question.vue", () => {
|
||||||
|
|
||||||
|
|
@ -57,23 +51,15 @@ function setupMocks({
|
||||||
dataFromStoreApi = [],
|
dataFromStoreApi = [],
|
||||||
}) {
|
}) {
|
||||||
//Mock store
|
//Mock store
|
||||||
store.getVehicleMakes = jest.fn(() => dataFromStoreApi);
|
const mountOptions = getMountOptions();
|
||||||
const mountOptions = getMountOptions({
|
|
||||||
store: {
|
const store = useMainStore();
|
||||||
getVehicleMakes: store.getVehicleMakes,
|
store.getVehicleMakes = jest.fn(() => dataFromStoreApi);
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
//Mock props
|
|
||||||
const mockMixin = {
|
|
||||||
methods: {
|
|
||||||
getCmsContent: jest.fn()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mountOptions.propsData = {
|
mountOptions.propsData = {
|
||||||
modelValue: modelValueProp,
|
modelValue: modelValueProp,
|
||||||
};
|
};
|
||||||
mountOptions.mixins = [mockMixin];
|
|
||||||
const wrapper = shallowMount(makeQuestion, mountOptions);
|
const wrapper = shallowMount(makeQuestion, mountOptions);
|
||||||
|
|
||||||
//Mock CMS content
|
//Mock CMS content
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ jest.mock("@/helpers/layout-helper.js", () => ({
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe("vehicle-make.vue", () => {
|
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
|
//Arrange
|
||||||
const makeQuestionInitialData = ["honda", "ford", "dodge"];
|
const makeQuestionInitialData = ["honda", "ford", "dodge"];
|
||||||
const { wrapper, apiPromise } = setupMocks({
|
const { wrapper, apiPromise } = setupMocks({
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue