Fixing unit tests
This commit is contained in:
parent
db8be5e8c9
commit
20ff377797
2 changed files with 22 additions and 4 deletions
|
|
@ -3,6 +3,7 @@ import vehicleDamage from "@/layouts/vehicle-damage/vehicle-damage.vue";
|
||||||
import funnelHeader from "@/common-components/funnel-header/funnel-header";
|
import funnelHeader from "@/common-components/funnel-header/funnel-header";
|
||||||
import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner";
|
import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner";
|
||||||
import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-header";
|
import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-header";
|
||||||
|
import replaceOptionsQuestion from"@/layouts/vehicle-damage/replace-options-question/replace-options-question";
|
||||||
|
|
||||||
// Supporting Files
|
// Supporting Files
|
||||||
import { settleAllPromises } from "@/helpers/layout-helper.js";
|
import { settleAllPromises } from "@/helpers/layout-helper.js";
|
||||||
|
|
@ -144,7 +145,9 @@ function setupMocks({
|
||||||
baseMixin.methods.dispatchNonBlockingStoreAction = jest.fn();
|
baseMixin.methods.dispatchNonBlockingStoreAction = jest.fn();
|
||||||
baseMixin.methods.dispatchNonBlockingStoreAction.mockImplementation(() => {
|
baseMixin.methods.dispatchNonBlockingStoreAction.mockImplementation(() => {
|
||||||
return Promise.resolve({
|
return Promise.resolve({
|
||||||
data: ["Front Window", "Back Window", "Side Window"],
|
driverSideOptions: {
|
||||||
|
availableReplacementOptions: ["Front", "Back", "Side"],
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
const apiResponses = {
|
const apiResponses = {
|
||||||
|
|
@ -159,7 +162,11 @@ function setupMocks({
|
||||||
"https://digitalconsumercms-dev.safelite.com/images/default-source/default-album/safelite-logo.svg?sfvrsn=45e7ed06_3",
|
"https://digitalconsumercms-dev.safelite.com/images/default-source/default-album/safelite-logo.svg?sfvrsn=45e7ed06_3",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
damageOptions: ["Front Window", "Back Window", "Side Window"],
|
damageOptions: {
|
||||||
|
driverSideOptions: {
|
||||||
|
availableReplacementOptions: ["Front", "Back", "Side"],
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const apiPromise = Promise.resolve(apiResponses);
|
const apiPromise = Promise.resolve(apiResponses);
|
||||||
|
|
@ -180,6 +187,11 @@ function setupMocks({
|
||||||
initializeComponent: jest.fn(),
|
initializeComponent: jest.fn(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const driverSideOptions = replaceOptionsQuestion
|
||||||
|
driverSideOptions.methods = {
|
||||||
|
initializeComponent: jest.fn(),
|
||||||
|
};
|
||||||
|
|
||||||
const mountOptions = getMountOptions(mountOptionsMockData);
|
const mountOptions = getMountOptions(mountOptionsMockData);
|
||||||
const wrapper = shallowMount(vehicleDamage, mountOptions);
|
const wrapper = shallowMount(vehicleDamage, mountOptions);
|
||||||
|
|
||||||
|
|
@ -197,5 +209,11 @@ function setupMocks({
|
||||||
funnelSubHeaderWrapper.vm.initializeComponent =
|
funnelSubHeaderWrapper.vm.initializeComponent =
|
||||||
funnelSubHeader.methods.initializeComponent;
|
funnelSubHeader.methods.initializeComponent;
|
||||||
|
|
||||||
|
const driverSideOptionsWrapper = wrapper.findComponent({
|
||||||
|
name: "replaceOptionsQuestion",
|
||||||
|
});
|
||||||
|
driverSideOptionsWrapper.vm.initializeComponent =
|
||||||
|
replaceOptionsQuestion.methods.initializeComponent;
|
||||||
|
|
||||||
return { wrapper, apiPromise };
|
return { wrapper, apiPromise };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
import funnelHeader from "@/common-components/funnel-header/funnel-header";
|
import funnelHeader from "@/common-components/funnel-header/funnel-header";
|
||||||
import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner";
|
import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner";
|
||||||
import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-header";
|
import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-header";
|
||||||
import replaceOptionsQuestion from"@/layouts/vehicle-damage/replace-options-question/replace-options-question"
|
import replaceOptionsQuestion from"@/layouts/vehicle-damage/replace-options-question/replace-options-question";
|
||||||
// Supporting files
|
// Supporting files
|
||||||
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
|
|
@ -62,7 +62,7 @@ export default {
|
||||||
resultMap.cmsContent.DriverSideReplaceOptionsQuestion, resultMap.damageOptions.driverSideOptions.availableReplacementOptions, 'DriverSideReplaceOptionsQuestion'
|
resultMap.cmsContent.DriverSideReplaceOptionsQuestion, resultMap.damageOptions.driverSideOptions.availableReplacementOptions, 'DriverSideReplaceOptionsQuestion'
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(resultMap)
|
//console.log(resultMap) for damageOptions and cms content data
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue