From 12e02313d1f750b08a7e2e0dc240acd12415c526 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Wed, 7 Jun 2023 14:32:16 -0400 Subject: [PATCH] CSR-1144 clear early bird whenever schedule data is reset --- jest.config.js | 2 +- src/store/index.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/jest.config.js b/jest.config.js index 28c5557cb..c712c24da 100644 --- a/jest.config.js +++ b/jest.config.js @@ -26,7 +26,7 @@ module.exports = { testMatch: ["**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"], coverageThreshold: { global: { - statements: 78, + statements: 77, // Got the go ahead from Mark to temporarily lower this. Taking out initialize component made the year,make,model and style coverage drop a bit. Once unit tests for license plate lookup, vin lookup and address lookup are in the coverage should go back up to 90 }, }, diff --git a/src/store/index.js b/src/store/index.js index f00d6c460..38dd859be 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -349,6 +349,17 @@ export const mutations = { state.order.schedule.endTime = null; state.order.schedule.routeCode = null; state.order.schedule.jobMaxMinutes = null; + + //early bird fee used on schedule page also needs reset when schedule is reset + const supportingItems = state.order.lineItems.supportingItems; + const removeEarlyBirdIndex = supportingItems.findIndex( + (item) => item.partNumber == PREMIUM_FEE_PART_TYPE + ); + + if (removeEarlyBirdIndex >= 0) { + supportingItems.splice(removeEarlyBirdIndex, 1); + state.order.lineItems.supportingItems = supportingItems; + } }, resetState(state) { Object.assign(state, getDefaultState());