Only for windshield replace
This commit is contained in:
Sneha 2023-06-13 12:41:09 +05:30
parent 418a29a08b
commit 350c96d8e4
2 changed files with 18 additions and 7 deletions

View file

@ -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;
}

View file

@ -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,
},
},
};