From 7ef8bc0b867b863c6c3e03d9444e7c263ac9b70d Mon Sep 17 00:00:00 2001 From: Sneha Date: Thu, 28 Nov 2024 15:48:16 +0530 Subject: [PATCH] CSR-2416 --- src/fmg-components/cart/cart.vue | 7 ++++--- .../promo-modal-question.spec.js | 12 ++++++++++++ .../promo-modal-question/promo-modal-question.vue | 7 +++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index 024c1f0e8..e21a5037a 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -298,8 +298,8 @@ export default { this.lineItems[category] = this.lineItems[category].filter( (lineItemsToKeep) => lineItemsToKeep.cartItemType != cartItemType ); - if (category == cartItemCategories.VAPS) { - await this.dispatchStoreAction(storeActions.SAVE_VAPS, this.lineItems.vaps, false); + if (category == cartItemCategories.VAPS || category == cartItemCategories.PROMOS) { + this.saveVaps(this.lineItems); } if (category == cartItemCategories.SUPPORTING_ITEMS) { await this.dispatchStoreAction( @@ -750,7 +750,8 @@ export default { return this.getCmsContent("RecycleFeeTextWidget", "Text"); }, showRecycleFeeCartItem() { - if (!this.isInsurance || this.isItac || this.isNoComp) { // CASH, ITAC, NOCOMP ORDERS + if (!this.isInsurance || this.isItac || this.isNoComp) { + // CASH, ITAC, NOCOMP ORDERS return !this.isRepair; } else { return false; diff --git a/src/fmg-components/promo-modal-question/promo-modal-question.spec.js b/src/fmg-components/promo-modal-question/promo-modal-question.spec.js index 435a53277..b2e0547b0 100644 --- a/src/fmg-components/promo-modal-question/promo-modal-question.spec.js +++ b/src/fmg-components/promo-modal-question/promo-modal-question.spec.js @@ -19,6 +19,11 @@ jest.mock("@/mixins/base-mixin", () => ({ return mockReturnsForStoreActions[action]; } ), + dispatchStoreAction: jest.fn( + (action, { promoCode, addableVaps }, pageNameToLog, someBool) => { + return mockReturnsForStoreActions[action]; + } + ), }, })); @@ -286,6 +291,13 @@ describe("promo-modal-question.vue", () => { (lineItemsToKeep) => getPromoCodeWithoutBundleIdentifier(lineItemsToKeep.promoCode) != promo )); + await baseMixin.methods.dispatchStoreAction( + storeActions.SAVE_ACTIVE_AND_OR_INACTIVE_PROMOS, + { + activePromos: lineItems.promos, + }, + false + ); //Assert expect(existingPromo).toEqual(lineItems.promos); diff --git a/src/fmg-components/promo-modal-question/promo-modal-question.vue b/src/fmg-components/promo-modal-question/promo-modal-question.vue index 97788a4b9..911522668 100644 --- a/src/fmg-components/promo-modal-question/promo-modal-question.vue +++ b/src/fmg-components/promo-modal-question/promo-modal-question.vue @@ -230,6 +230,13 @@ export default { (lineItemsToKeep) => getPromoCodeWithoutBundleIdentifier(lineItemsToKeep.promoCode) != promo ); + await baseMixin.methods.dispatchStoreAction( + storeActions.SAVE_ACTIVE_AND_OR_INACTIVE_PROMOS, + { + activePromos: this.lineItems.promos, + }, + false + ); }, getErrorMessage(error, additionalInfo) { switch (error) {