CSR-2234: fix unit tests
This commit is contained in:
parent
b48a62b3fc
commit
4814b0ce39
2 changed files with 23 additions and 14 deletions
|
|
@ -65,6 +65,24 @@ jest.mock("@/mixins/base-mixin", () => ({
|
|||
},
|
||||
}));
|
||||
|
||||
const mockExperimentSettings = experimentSettings;
|
||||
|
||||
jest.mock("@/mixins/experiment-mixin.js", () => ({
|
||||
methods: {
|
||||
getSettingValue(settingName) {
|
||||
if (settingName === mockExperimentSettings.SERVICE_PACKAGE_DISCOUNT) {
|
||||
return true;
|
||||
}
|
||||
if (settingName === mockExperimentSettings.INSURANCE_TAB_TO_DISPLAY_THRESHOLD_INTERNAL) {
|
||||
return 300;
|
||||
} else if (settingName === mockExperimentSettings.INSURANCE_TAB_TO_DISPLAY_THRESHOLD_EXTERNAL) {
|
||||
return 500;
|
||||
}
|
||||
return "test";
|
||||
},
|
||||
},
|
||||
}));
|
||||
|
||||
const mockMixin = {
|
||||
methods: {
|
||||
filterOutFees: jest.fn().mockImplementation(() => {
|
||||
|
|
@ -73,12 +91,6 @@ const mockMixin = {
|
|||
isFormValid: jest.fn().mockImplementation(() => {
|
||||
return true;
|
||||
}),
|
||||
getSettingValue: jest.fn((settingName) => {
|
||||
if (settingName === experimentSettings.SERVICE_PACKAGE_DISCOUNT) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}),
|
||||
},
|
||||
};
|
||||
let mockTierOnePrice = 501;
|
||||
|
|
@ -261,7 +273,7 @@ describe("quote.vue", () => {
|
|||
};
|
||||
const { wrapper } = setupMocks({});
|
||||
|
||||
//mock this to avoid needing to populate this.$route in an unrelated test
|
||||
//mock this to avoid needing to populate this.$route in an unrelated test
|
||||
wrapper.vm.getDefaultIsInsuranceSelectedValue = jest.fn();
|
||||
|
||||
//Act
|
||||
|
|
@ -309,7 +321,7 @@ describe("quote.vue", () => {
|
|||
|
||||
wrapper.vm.$route = { query: { isInsurance: "false" } };
|
||||
|
||||
const isServicePackageDiscount = mockMixin.methods.getSettingValue(
|
||||
const isServicePackageDiscount = experimentMixin.methods.getSettingValue(
|
||||
experimentSettings.SERVICE_PACKAGE_DISCOUNT
|
||||
);
|
||||
|
||||
|
|
@ -701,7 +713,7 @@ describe("quote.vue", () => {
|
|||
inactivePromos: [],
|
||||
},
|
||||
},
|
||||
externalParameterState: { isExternalParameter: true },
|
||||
externalParameterState: { isExternalParameter: 1 },
|
||||
externalParameterQuote: {
|
||||
isInsurance: true,
|
||||
servicePackage: "glassonly",
|
||||
|
|
@ -758,8 +770,6 @@ function setupMocks({ customMountOptions }) {
|
|||
baseMixin.methods.ResetExternalParamsAndHideModal = jest.fn();
|
||||
baseMixin.methods.isFormValid = jest.fn().mockReturnValue(true);
|
||||
mountOptions.global.mocks["$store"] = store;
|
||||
store.getters.experimentSettings = "test value";
|
||||
|
||||
mountOptions["attachTo"] = document.body;
|
||||
|
||||
const wrapper = shallowMount(quote, mountOptions);
|
||||
|
|
|
|||
|
|
@ -338,7 +338,6 @@ export default {
|
|||
let internalThreshold = experimentMixin.methods.getSettingValue(
|
||||
experimentSettings.INSURANCE_TAB_TO_DISPLAY_THRESHOLD_INTERNAL
|
||||
);
|
||||
|
||||
const isExternalParameter = store.getters.externalParameterState?.isExternalParameter;
|
||||
|
||||
if (isExternalParameter === externalParameterStatus.NOT_SET) {
|
||||
|
|
@ -352,7 +351,7 @@ export default {
|
|||
baseMixin.methods.ResetExternalParamsAndHideModal();
|
||||
} else {
|
||||
// user came from an external source
|
||||
if (store.getters.externalParameterQuote.isInsurance == true) {
|
||||
if (store.getters.externalParameterQuote?.isInsurance == true) {
|
||||
// did user intentionally select insurance?
|
||||
vm.isInsuranceSelected = true;
|
||||
vm.servicePackage = store.getters.externalParameterQuote.servicePackage;
|
||||
|
|
@ -571,7 +570,7 @@ export default {
|
|||
}
|
||||
});
|
||||
this.$nextTick(() => {
|
||||
const availablePackageNames = this.$refs.servicePackage.servicePackageAnswers;
|
||||
const availablePackageNames = this.$refs.servicePackage?.servicePackageAnswers;
|
||||
var eventLabel = "";
|
||||
availablePackageNames?.forEach((tier) => {
|
||||
if (tier) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue