From 350c96d8e47f3547e1267a0527fdeb4401a2d81b Mon Sep 17 00:00:00 2001 From: Sneha Date: Tue, 13 Jun 2023 12:41:09 +0530 Subject: [PATCH] CSR-1415 Only for windshield replace --- src/store/index.js | 9 ++++++++- src/store/store.spec.js | 16 ++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 75cb3b5a4..180d17627 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1531,7 +1531,14 @@ export const actions = { context.commit(storeMutations.UPDATE_VEHICLE_VIN, null); }, isVinOptionalVehicle(context) { - if (singleWindshieldCarid.find((item) => item === context.state.order.vehicle.carId)) { + if ( + singleWindshieldCarid.find((item) => item === context.state.order.vehicle.carId) && + context.state.order.damage.glassToReplace.find( + (glassToReplace) => + glassToReplace.glassLocation.toLowerCase() === + damageLocationsSelected.WINDSHIELD.toLowerCase() + ) + ) { return true; } diff --git a/src/store/store.spec.js b/src/store/store.spec.js index 862c5c9d8..2ee66ee0b 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -2812,19 +2812,23 @@ describe("isVinOptionalVehicle", () => { } ); const testcarID = [ - ["CR00000100", "make", false], - ["CR00067899", "make2", true], - ["CR00062396", "make3", true], - ["CR00066428", "make4", false], + ["CR00000100", "make", [{ glassLocation: "driver" }], false], + ["CR00067899", "make2", [{ glassLocation: "windshield" }], true], + ["CR00062396","make3", [{ glassLocation: "windshield" }, { glassLocation: "driver" }], true], + ["CR00066428", "make4", [{ glassLocation: "rear" }], false], ]; + test.each(testcarID)( - "%s %s should skip vin lookup is %s", - async (carId, make, expectedVinSkip) => { + "%s %s %o should skip vin lookup is %s", + async (carId, make, glassLocation, expectedVinSkip) => { const context = state; context.state = { order: { vehicle: { make: make, carId: carId }, + damage: { + glassToReplace: glassLocation, + }, }, };