Merge pull request #2073 from Safelite/feature/CSR-2323

CSR-2323 save vaps to store when promo added
This commit is contained in:
CarlNation 2024-11-06 09:09:44 -05:00 committed by GitHub
commit 819468c5dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 14 deletions

View file

@ -134,7 +134,8 @@
v-model="lineItems"
:addableVaps="availableVaps"
:pageName="pageName"
modalWidgetName="PromoModalWidget" />
modalWidgetName="PromoModalWidget"
@promoAdded="saveVaps" />
</div>
</div>
<div
@ -286,7 +287,12 @@ export default {
this.lineItems[category] = this.lineItems[category].filter(
(lineItemsToKeep) => lineItemsToKeep.cartItemType != cartItemType
);
await this.dispatchStoreAction(storeActions.SAVE_VAPS, this.lineItems.vaps, false);
},
async saveVaps(vaps) {
this.lineItems.vaps = [...vaps];
await this.dispatchStoreAction(storeActions.SAVE_VAPS, this.lineItems.vaps, false);
},

View file

@ -220,7 +220,7 @@ export default {
additionalInfo: promoValidationResponse?.additionalInfo,
};
},
removeItem(promo) {
async removeItem(promo) {
this.lineItems[cartItemCategories.PROMOS] = this.lineItems[
cartItemCategories.PROMOS
].filter(
@ -320,6 +320,9 @@ export default {
this.lineItems.vaps?.push(...getVaps);
}
this.lineItems?.promos.push(...promoCodeData.promoCode);
this.$emit('promoAdded', this.lineItems.vaps);
this.closeModal();
} else {
this.getErrorMessage(promoCodeData.errorCode, promoCodeData.additionalInfo);

View file

@ -72,7 +72,7 @@ beforeEach(() => {
},
policy: {
isNoComp: false,
}
},
},
damage: {},
payment: {
@ -616,9 +616,11 @@ describe("computed properties...", () => {
//Arrange
const { wrapper } = setupMocks({});
const lineItems = {
glassParts: [{
partType: "RECALIBRATION",
}]
glassParts: [
{
partType: "RECALIBRATION",
},
],
};
wrapper.vm.submittedOrder = {
@ -639,7 +641,7 @@ describe("computed properties...", () => {
lineItems: {
glassParts: {
partType: "Recalibration",
}
},
},
serviceLocation: store.getters.order.serviceLocation,
};
@ -653,13 +655,15 @@ describe("computed properties...", () => {
// Assert
expect(testValue).toEqual(true);
});
test ("Itac/NoComp with Recal should return false for shouldHideRecalibration", async () => {
test("Itac/NoComp with Recal should return false for shouldHideRecalibration", async () => {
//Arrange
const { wrapper } = setupMocks({});
const lineItems = {
glassParts: [{
partType: "RECALIBRATION",
}]
glassParts: [
{
partType: "RECALIBRATION",
},
],
};
wrapper.vm.submittedOrder = {
@ -688,7 +692,7 @@ describe("computed properties...", () => {
// Assert
expect(testValue).toEqual(false);
});
});
});
function setupMocks({ customMountOptions }) {
@ -706,7 +710,7 @@ function setupMocks({ customMountOptions }) {
if (settingName === experimentSettings.RECAL_PRICE_REMOVE) {
return "true";
}
return "false";
}),
},