fixed unit tests
This commit is contained in:
parent
ebbc522c1c
commit
acc8e791af
4 changed files with 58 additions and 33 deletions
|
|
@ -332,8 +332,6 @@ describe("mobile-location-modal-questions.vue", () => {
|
|||
expect(wrapper.vm.internalModel.addressQuestions.streetAddress).toEqual("");
|
||||
expect(wrapper.vm.internalModel.addressQuestions.apartmentNumberOrBusinessName).toEqual("");
|
||||
expect(wrapper.vm.internalModel.addressQuestions.city).toEqual("");
|
||||
expect(wrapper.vm.internalModel.addressQuestions.state).toEqual("");
|
||||
expect(wrapper.vm.internalModel.addressQuestions.zipCode).toEqual("");
|
||||
expect(wrapper.vm.internalModel.isVehicleProtected).toEqual(null);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ export default {
|
|||
return {
|
||||
internalModel: deepClone(this.modelValue),
|
||||
displayInvalidZipAlert: false,
|
||||
modalName: "MobileLocationModalWidget",
|
||||
};
|
||||
},
|
||||
props: {
|
||||
|
|
@ -108,6 +107,9 @@ export default {
|
|||
}
|
||||
return this.getCmsContent(this.linkWidgetName, "BodyText");
|
||||
},
|
||||
modalName() {
|
||||
return "MobileLocationModalWidget";
|
||||
},
|
||||
modalHeaderText() {
|
||||
return this.getCmsContent(this.modalWidgetName, "HeaderText");
|
||||
},
|
||||
|
|
@ -115,9 +117,6 @@ export default {
|
|||
const cmsContentText = this.getCmsContent("MobileFeeDisclaimerWidget", "Text");
|
||||
return cmsContentText.replaceAll("{custom:mobileFee}", this.mobileFee);
|
||||
},
|
||||
modalFooterText() {
|
||||
return this.getCmsContent(this.modalWidgetName, "FooterText");
|
||||
},
|
||||
mobileFee() {
|
||||
if (!this.modelValue.mobileFeePart) {
|
||||
return 0;
|
||||
|
|
@ -127,7 +126,11 @@ export default {
|
|||
this.modelValue.mobileFeePart.sellingPrice +
|
||||
this.modelValue.mobileFeePart.kitPrice
|
||||
);
|
||||
},
|
||||
modalFooterText() {
|
||||
return this.getCmsContent(this.modalWidgetName, "FooterText");
|
||||
},
|
||||
|
||||
addressModel: {
|
||||
get: function () {
|
||||
return this.modelValue.addressQuestions;
|
||||
|
|
|
|||
|
|
@ -177,6 +177,12 @@ describe("service-location.vue", () => {
|
|||
wrapper.vm.$refs.mobileLocationModalQuestions.resetComponent = jest.fn();
|
||||
wrapper.vm.$refs.serviceZipCodeQuestion.resetMobileFeePart = jest.fn();
|
||||
|
||||
const newServiceZipCodeQuestion = {
|
||||
zipCode: "61606",
|
||||
state: "IL",
|
||||
isServiceable: true,
|
||||
};
|
||||
|
||||
const mobileLocationQuestions = {
|
||||
addressQuestions: {
|
||||
streetAddress: "5555 Sulgrave Dr",
|
||||
|
|
@ -186,8 +192,7 @@ describe("service-location.vue", () => {
|
|||
zipCode: "43054",
|
||||
},
|
||||
isVehicleProtected: true,
|
||||
serviceZipCode: "43054",
|
||||
mobileFee: 0,
|
||||
mobileFeePart: null,
|
||||
};
|
||||
wrapper.vm.mobileLocationQuestions = mobileLocationQuestions;
|
||||
|
||||
|
|
@ -196,11 +201,11 @@ describe("service-location.vue", () => {
|
|||
streetAddress: "",
|
||||
apartmentNumberOrBusinessName: "",
|
||||
city: "",
|
||||
state: "",
|
||||
zipCode: "",
|
||||
state: "IL",
|
||||
zipCode: "61606",
|
||||
},
|
||||
isVehicleProtected: null,
|
||||
serviceZipCode: "43081",
|
||||
mobileFeePart: null
|
||||
};
|
||||
|
||||
const serviceZipCodeComponent = wrapper.findComponent({
|
||||
|
|
@ -208,7 +213,7 @@ describe("service-location.vue", () => {
|
|||
});
|
||||
|
||||
// Act
|
||||
serviceZipCodeComponent.vm.$emit("updated-service-zip-code", "43081");
|
||||
serviceZipCodeComponent.vm.$emit("update:modelValue", newServiceZipCodeQuestion);
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.mobileLocationQuestions).toStrictEqual(newMobileLocationQuestions);
|
||||
|
|
@ -230,7 +235,7 @@ describe("service-location.vue", () => {
|
|||
zipCode: "",
|
||||
},
|
||||
isVehicleProtected: null,
|
||||
serviceZipCode: "43081",
|
||||
mobileFeePart: null,
|
||||
};
|
||||
wrapper.vm.mobileLocationQuestions = mobileLocationQuestions;
|
||||
|
||||
|
|
@ -243,8 +248,7 @@ describe("service-location.vue", () => {
|
|||
zipCode: "43054",
|
||||
},
|
||||
isVehicleProtected: true,
|
||||
serviceZipCode: "43054",
|
||||
mobileFee: 0,
|
||||
mobileFeePart: null,
|
||||
};
|
||||
|
||||
const mobileLocationComponent = wrapper.findComponent({
|
||||
|
|
@ -264,29 +268,50 @@ describe("service-location.vue", () => {
|
|||
wrapper.vm.$refs.mobileLocationModalQuestions.resetComponent = jest.fn();
|
||||
wrapper.vm.$refs.serviceZipCodeQuestion.resetMobileFeePart = jest.fn();
|
||||
|
||||
const serviceZipCodeInfo = {
|
||||
state: "OH",
|
||||
zipCode: "43054",
|
||||
isServiceable: true,
|
||||
const mobileLocationQuestions = {
|
||||
addressQuestions: {
|
||||
streetAddress: "",
|
||||
apartmentNumberOrBusinessName: "",
|
||||
city: "",
|
||||
state: "",
|
||||
zipCode: "",
|
||||
},
|
||||
isVehicleProtected: null,
|
||||
mobileFeePart: null,
|
||||
};
|
||||
wrapper.vm.mobileLocationQuestions = mobileLocationQuestions;
|
||||
|
||||
const newServiceZipCodeInfo = {
|
||||
state: "OH",
|
||||
zipCode: "43081",
|
||||
isServiceable: true,
|
||||
const newMobileLocationQuestions = {
|
||||
addressQuestions: {
|
||||
streetAddress: "5555 Rustic Dr",
|
||||
apartmentNumberOrBusinessName: "Apt 1",
|
||||
city: "Westerville",
|
||||
state: "OH",
|
||||
zipCode: "43081",
|
||||
},
|
||||
isVehicleProtected: true,
|
||||
mobileFeePart: null,
|
||||
};
|
||||
wrapper.vm.serviceZipCodeQuestion = serviceZipCodeInfo;
|
||||
|
||||
const mobileLocationComponent = wrapper.findComponent({
|
||||
ref: "mobileLocationModalQuestions",
|
||||
});
|
||||
|
||||
// Act
|
||||
mobileLocationComponent.vm.$emit("updated-zip-code", {
|
||||
wrapper.vm.serviceZipCodeQuestion = {
|
||||
zipCode: "61606",
|
||||
state: "IL",
|
||||
isServiceable: true,
|
||||
};
|
||||
|
||||
const newServiceZipCodeInfo = {
|
||||
state: "OH",
|
||||
zipCode: "43081",
|
||||
isServiceable: true,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// Act
|
||||
mobileLocationComponent.vm.$emit("update:modelValue", newMobileLocationQuestions);
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.serviceZipCodeQuestion).toStrictEqual(newServiceZipCodeInfo);
|
||||
|
|
|
|||
|
|
@ -128,12 +128,11 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
arePagePrerequisitesValid() {
|
||||
return true;
|
||||
// return (
|
||||
// store.getters.lineItems.supportingItems !== null &&
|
||||
// store.getters.order.serviceLocation.zipCode !== null &&
|
||||
// store.getters.payment.isInsurance !== null
|
||||
// );
|
||||
return (
|
||||
store.getters.lineItems.supportingItems !== null &&
|
||||
store.getters.order.serviceLocation.zipCode !== null &&
|
||||
store.getters.payment.isInsurance !== null
|
||||
);
|
||||
},
|
||||
setData(mobileFeePart) {
|
||||
if (mobileFeePart) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue