Merge branch 'release/2025.02.27' into feature/CASH-151
This commit is contained in:
commit
6d9c7d518f
4 changed files with 31 additions and 64 deletions
|
|
@ -203,7 +203,7 @@ describe("mobile-location-modal-questions.vue", () => {
|
||||||
expect(wrapper.vm.$refs.MobileLocationModalWidget.openModal).toHaveBeenCalled();
|
expect(wrapper.vm.$refs.MobileLocationModalWidget.openModal).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should emit updated-mobile-location-questions on setMobileLocation for a valid address and vehicle protection answer", async () => {
|
it("Should emit setMobileLocationAndProceed on setMobileLocation for a valid address and vehicle protection answer", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const mobileLocationQuestions = {
|
const mobileLocationQuestions = {
|
||||||
addressQuestions: {
|
addressQuestions: {
|
||||||
|
|
@ -240,26 +240,19 @@ describe("mobile-location-modal-questions.vue", () => {
|
||||||
});
|
});
|
||||||
wrapper.vm.$refs.MobileLocationModalWidget.closeModal = jest.fn();
|
wrapper.vm.$refs.MobileLocationModalWidget.closeModal = jest.fn();
|
||||||
|
|
||||||
// Mock the emitEvent function
|
|
||||||
wrapper.vm.emitEvent = jest.fn(async (eventName, payload) => {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
wrapper.vm.$emit(eventName, newMobileLocationQuestions, resolve);
|
|
||||||
resolve(newMobileLocationQuestions);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.internalModel = newMobileLocationQuestions;
|
wrapper.vm.internalModel = newMobileLocationQuestions;
|
||||||
|
|
||||||
await wrapper.vm.setMobileLocation();
|
await wrapper.vm.setMobileLocation();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.emitted()["updated-mobile-location-questions"]).toBeTruthy();
|
expect(wrapper.emitted()["setMobileLocationAndProceed"]).toBeTruthy();
|
||||||
expect(wrapper.emitted()["updated-mobile-location-questions"][0][0]).toBe(
|
expect(wrapper.emitted()["setMobileLocationAndProceed"][0][0]).toStrictEqual(
|
||||||
newMobileLocationQuestions
|
newMobileLocationQuestions
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should not emit updated-mobile-location-questions on setMobileLocation for an invalid address zip code", async () => {
|
it("Should not emit setMobileLocationAndProceed on setMobileLocation for an invalid address zip code", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const mobileLocationQuestions = {
|
const mobileLocationQuestions = {
|
||||||
addressQuestions: {
|
addressQuestions: {
|
||||||
|
|
@ -302,7 +295,7 @@ describe("mobile-location-modal-questions.vue", () => {
|
||||||
await wrapper.vm.setMobileLocation();
|
await wrapper.vm.setMobileLocation();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.emitted("updated-mobile-location-questions")).not.toBeTruthy();
|
expect(wrapper.emitted("setMobileLocationAndProceed")).not.toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should display invalid zip alert for invalid address zip inputs", async () => {
|
it("Should display invalid zip alert for invalid address zip inputs", async () => {
|
||||||
|
|
|
||||||
|
|
@ -97,8 +97,7 @@ export default {
|
||||||
"updated-mobile-fee-part",
|
"updated-mobile-fee-part",
|
||||||
"updated-contains-military-base",
|
"updated-contains-military-base",
|
||||||
"updated-bill-to-account-number",
|
"updated-bill-to-account-number",
|
||||||
"mobileLocationSelected",
|
"setMobileLocationAndProceed",
|
||||||
"updated-mobile-location-questions",
|
|
||||||
],
|
],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -287,15 +286,7 @@ export default {
|
||||||
this.$emit("updated-bill-to-account-number", billToAccountNumber);
|
this.$emit("updated-bill-to-account-number", billToAccountNumber);
|
||||||
}
|
}
|
||||||
// update the page level model
|
// update the page level model
|
||||||
await this.emitEvent("updated-mobile-location-questions", this.internalModel);
|
this.$emit("setMobileLocationAndProceed", this.internalModel);
|
||||||
|
|
||||||
this.$emit("mobileLocationSelected");
|
|
||||||
},
|
|
||||||
//creating emitEvent function to raise events with resolve callback to handle events sequencing
|
|
||||||
async emitEvent(eventName, payload) {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
this.$emit(eventName, payload, resolve);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|
|
||||||
|
|
@ -435,6 +435,7 @@ describe("service-location.vue", () => {
|
||||||
ref: "serviceZipCodeQuestion",
|
ref: "serviceZipCodeQuestion",
|
||||||
});
|
});
|
||||||
serviceZipCodeComponent.resetMobileFeePart = jest.fn();
|
serviceZipCodeComponent.resetMobileFeePart = jest.fn();
|
||||||
|
wrapper.vm.forwardButtonAction = jest.fn();
|
||||||
|
|
||||||
const mobileLocationQuestions = {
|
const mobileLocationQuestions = {
|
||||||
addressQuestions: {
|
addressQuestions: {
|
||||||
|
|
@ -447,7 +448,6 @@ describe("service-location.vue", () => {
|
||||||
isVehicleProtected: null,
|
isVehicleProtected: null,
|
||||||
};
|
};
|
||||||
wrapper.vm.mobileLocationQuestions = mobileLocationQuestions;
|
wrapper.vm.mobileLocationQuestions = mobileLocationQuestions;
|
||||||
|
|
||||||
const newMobileLocationQuestions = {
|
const newMobileLocationQuestions = {
|
||||||
addressQuestions: {
|
addressQuestions: {
|
||||||
streetAddress: "5555 Sulgrave Dr",
|
streetAddress: "5555 Sulgrave Dr",
|
||||||
|
|
@ -461,21 +461,13 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
||||||
// Mock the emitEvent function
|
|
||||||
mobileLocationQuestionsComponent.vm.emitEvent = jest.fn(async (eventName, payload) => {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
mobileLocationQuestionsComponent.vm.$emit(eventName, payload, resolve);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Trigger the event
|
// Trigger the event
|
||||||
await mobileLocationQuestionsComponent.vm.emitEvent(
|
await mobileLocationQuestionsComponent.vm.$emit(
|
||||||
"updated-mobile-location-questions",
|
"setMobileLocationAndProceed",
|
||||||
newMobileLocationQuestions
|
newMobileLocationQuestions
|
||||||
);
|
);
|
||||||
|
|
||||||
await wrapper.vm.$nextTick(); // Wait for DOM updates
|
await wrapper.vm.$nextTick(); // Wait for DOM updates
|
||||||
await new Promise((resolve) => setTimeout(resolve, 0)); // Wait for promise to resolve
|
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.mobileLocationQuestions).toStrictEqual(newMobileLocationQuestions);
|
expect(wrapper.vm.mobileLocationQuestions).toStrictEqual(newMobileLocationQuestions);
|
||||||
|
|
@ -502,7 +494,7 @@ describe("service-location.vue", () => {
|
||||||
ref: "serviceZipCodeQuestion",
|
ref: "serviceZipCodeQuestion",
|
||||||
});
|
});
|
||||||
serviceZipCodeComponent.resetMobileFeePart = jest.fn();
|
serviceZipCodeComponent.resetMobileFeePart = jest.fn();
|
||||||
|
wrapper.vm.forwardButtonAction = jest.fn();
|
||||||
const mobileLocationQuestions = {
|
const mobileLocationQuestions = {
|
||||||
addressQuestions: {
|
addressQuestions: {
|
||||||
streetAddress: "",
|
streetAddress: "",
|
||||||
|
|
@ -542,21 +534,13 @@ describe("service-location.vue", () => {
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
||||||
// Mock the emitEvent function
|
|
||||||
mobileLocationQuestionsComponent.vm.emitEvent = jest.fn(async (eventName, payload) => {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
mobileLocationQuestionsComponent.vm.$emit(eventName, payload, resolve);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Trigger the event
|
// Trigger the event
|
||||||
await mobileLocationQuestionsComponent.vm.emitEvent(
|
await mobileLocationQuestionsComponent.vm.$emit(
|
||||||
"updated-mobile-location-questions",
|
"setMobileLocationAndProceed",
|
||||||
newMobileLocationQuestions
|
newMobileLocationQuestions
|
||||||
);
|
);
|
||||||
|
|
||||||
await wrapper.vm.$nextTick(); // Wait for DOM updates
|
await wrapper.vm.$nextTick(); // Wait for DOM updates
|
||||||
await new Promise((resolve) => setTimeout(resolve, 0)); // Wait for promise to resolve
|
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.serviceZipCodeQuestion).toStrictEqual(newServiceZipCodeInfo);
|
expect(wrapper.vm.serviceZipCodeQuestion).toStrictEqual(newServiceZipCodeInfo);
|
||||||
|
|
@ -578,6 +562,7 @@ describe("service-location.vue", () => {
|
||||||
ref: "mobileLocationQuestions",
|
ref: "mobileLocationQuestions",
|
||||||
});
|
});
|
||||||
mobileLocationQuestionsComponent.resetComponent = jest.fn();
|
mobileLocationQuestionsComponent.resetComponent = jest.fn();
|
||||||
|
wrapper.vm.forwardButtonAction = jest.fn();
|
||||||
|
|
||||||
const serviceZipCodeComponent = wrapper.findComponent({
|
const serviceZipCodeComponent = wrapper.findComponent({
|
||||||
ref: "serviceZipCodeQuestion",
|
ref: "serviceZipCodeQuestion",
|
||||||
|
|
@ -596,7 +581,10 @@ describe("service-location.vue", () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
mobileLocationQuestionsComponent.vm.$emit("update:modelValue", mobileLocationQuestions);
|
mobileLocationQuestionsComponent.vm.$emit(
|
||||||
|
"setMobileLocationAndProceed",
|
||||||
|
mobileLocationQuestions
|
||||||
|
);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.selectedAppointmentType).toStrictEqual("Mobile");
|
expect(wrapper.vm.selectedAppointmentType).toStrictEqual("Mobile");
|
||||||
|
|
@ -1429,6 +1417,5 @@ function setupMocks({ mountOptionsMockData = {} }) {
|
||||||
const mountOptions = getMountOptions(mountOptionsMockData);
|
const mountOptions = getMountOptions(mountOptionsMockData);
|
||||||
const wrapper = shallowMount(serviceLocation, mountOptions);
|
const wrapper = shallowMount(serviceLocation, mountOptions);
|
||||||
wrapper.vm.setCmsContent = baseMixin.methods.setCmsContent;
|
wrapper.vm.setCmsContent = baseMixin.methods.setCmsContent;
|
||||||
|
|
||||||
return { wrapper, apiPromise };
|
return { wrapper, apiPromise };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,12 +93,11 @@
|
||||||
@updated-serviceability="setServiceabilityDetails"
|
@updated-serviceability="setServiceabilityDetails"
|
||||||
@updated-contains-military-base="setContainsMilitaryBase"
|
@updated-contains-military-base="setContainsMilitaryBase"
|
||||||
@updated-mobile-ctu="setCtuForMobile"
|
@updated-mobile-ctu="setCtuForMobile"
|
||||||
@updated-mobile-location-questions="setMobileLocationQuestions"
|
|
||||||
validationRules="mobile-location-required"
|
validationRules="mobile-location-required"
|
||||||
ref="mobileLocationQuestions"
|
ref="mobileLocationQuestions"
|
||||||
linkWidgetName="MobileLocationLinkWidget"
|
linkWidgetName="MobileLocationLinkWidget"
|
||||||
modalWidgetName="MobileLocationModalWidget"
|
modalWidgetName="MobileLocationModalWidget"
|
||||||
@mobileLocationSelected="forwardButtonAction" />
|
@setMobileLocationAndProceed="setMobileLocationQuestions" />
|
||||||
|
|
||||||
<shopQuestion
|
<shopQuestion
|
||||||
ref="shopQuestion"
|
ref="shopQuestion"
|
||||||
|
|
@ -295,19 +294,6 @@ export default {
|
||||||
isVehicleProtected: this.isVehicleProtected,
|
isVehicleProtected: this.isVehicleProtected,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async set(newValue) {
|
|
||||||
if (newValue.addressQuestions.zipCode !== this.zipCode) {
|
|
||||||
await getShopProviderData(newValue.addressQuestions.zipCode).then((result) => {
|
|
||||||
this.shopProviderData = result.data;
|
|
||||||
this.selectedProvider = new Provider(
|
|
||||||
this.shopProviderData.mobileProviderNumber
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.setMobileLocation(newValue);
|
|
||||||
//handle promise
|
|
||||||
newValue.resolve?.();
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
isServiceableMobile() {
|
isServiceableMobile() {
|
||||||
if (this.isRecalibrationServiceableMobile !== null) {
|
if (this.isRecalibrationServiceableMobile !== null) {
|
||||||
|
|
@ -488,8 +474,18 @@ export default {
|
||||||
this.mobileFeePart = mobileFeePart;
|
this.mobileFeePart = mobileFeePart;
|
||||||
},
|
},
|
||||||
//creating async function as the computed property can not directly handle asynchronous operations or promises.
|
//creating async function as the computed property can not directly handle asynchronous operations or promises.
|
||||||
async setMobileLocationQuestions(newValue, resolve) {
|
async setMobileLocationQuestions(newValue) {
|
||||||
this.mobileLocationQuestions = { ...newValue, resolve };
|
if (newValue.addressQuestions.zipCode !== this.zipCode) {
|
||||||
|
await getShopProviderData(newValue.addressQuestions.zipCode).then((result) => {
|
||||||
|
this.shopProviderData = result.data;
|
||||||
|
this.selectedProvider = new Provider(
|
||||||
|
this.shopProviderData.mobileProviderNumber
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.setMobileLocation(newValue);
|
||||||
|
//proceed to next page
|
||||||
|
this.forwardButtonAction();
|
||||||
},
|
},
|
||||||
getServiceAddressFromStore() {
|
getServiceAddressFromStore() {
|
||||||
return store.getters.order.serviceLocation.address;
|
return store.getters.order.serviceLocation.address;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue