CSR-1338
If there is no windshield selected then do not require a vin lookup
This commit is contained in:
parent
024f2ab30e
commit
e316378d2c
3 changed files with 12 additions and 5 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import baseMixin from "@/mixins/base-mixin.js";
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
import { storeActions } from "@/constants/store-actions";
|
import { storeActions } from "@/constants/store-actions";
|
||||||
|
import { damageLocationsSelected as glassLocations } from "@/constants/damage-locations-selected";
|
||||||
|
|
||||||
export function getDamageString() {
|
export function getDamageString() {
|
||||||
// If it's a repair it's always a windshield.
|
// If it's a repair it's always a windshield.
|
||||||
|
|
@ -45,6 +46,11 @@ export function getIsWindshieldOnly() {
|
||||||
return returnString;
|
return returnString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function hasWindshield() {
|
||||||
|
const windshieldMatches = store.getters.order.damage.glassToReplace?.filter((glassToReplace) => glassToReplace.glassLocation === glassLocations.WINDSHIELD) ?? [];
|
||||||
|
return windshieldMatches.length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
export async function isGlassAvailableForCarId(carId) {
|
export async function isGlassAvailableForCarId(carId) {
|
||||||
const newGlassOptions = await baseMixin.methods.dispatchStoreAction(
|
const newGlassOptions = await baseMixin.methods.dispatchStoreAction(
|
||||||
storeActions.GET_DAMAGE_OPTIONS,
|
storeActions.GET_DAMAGE_OPTIONS,
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import { storeActions } from "@/constants/store-actions.js";
|
||||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
import experimentMixin from "@/mixins/experiment-mixin";
|
import experimentMixin from "@/mixins/experiment-mixin";
|
||||||
import { experimentSettings } from "@/constants/experiments";
|
import { experimentSettings } from "@/constants/experiments";
|
||||||
|
import { hasWindshield } from "@/helpers/damage-helper";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
|
|
||||||
|
|
@ -72,7 +73,7 @@ export async function skipVinLookup() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
store.getters.damage.isRepair ||
|
store.getters.damage.isRepair ||
|
||||||
isVinOptionalVehicle ||
|
isVinOptionalVehicle || !hasWindshield() ||
|
||||||
experimentMixin.methods.hasSettingEqualTo(experimentSettings.SUPPRESS_VIN_CAPTURE, "true")
|
experimentMixin.methods.hasSettingEqualTo(experimentSettings.SUPPRESS_VIN_CAPTURE, "true")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -83,8 +84,8 @@ export async function skipVinLookupNotRepair() {
|
||||||
: false;
|
: false;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
!store.getters.damage.isRepair &&
|
!store.getters.damage.isRepair &&
|
||||||
(isVinOptionalVehicle ||
|
(isVinOptionalVehicle || !hasWindshield() ||
|
||||||
experimentMixin.methods.hasSettingEqualTo(
|
experimentMixin.methods.hasSettingEqualTo(
|
||||||
experimentSettings.SUPPRESS_VIN_CAPTURE,
|
experimentSettings.SUPPRESS_VIN_CAPTURE,
|
||||||
"true"
|
"true"
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ describe("getPageToRouteExistingOrderTo", () => {
|
||||||
expect(result).toBe(fmgPageValues.VEHICLE_DAMAGE);
|
expect(result).toBe(fmgPageValues.VEHICLE_DAMAGE);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("user has YMMS and no vehicle questions > should return vin-lookup", async () => {
|
test("user has YMMS and no vehicle questions > should return estimate", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const toRoute = {
|
const toRoute = {
|
||||||
query: {},
|
query: {},
|
||||||
|
|
@ -172,7 +172,7 @@ describe("getPageToRouteExistingOrderTo", () => {
|
||||||
const result = await getPageToRouteExistingOrderTo(toRoute, false);
|
const result = await getPageToRouteExistingOrderTo(toRoute, false);
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
expect(result).toBe(fmgPageValues.VIN_LOOKUP);
|
expect(result).toBe(fmgPageValues.ESTIMATE);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("user has YMMS but no questions or carId > should return estimate", async () => {
|
test("user has YMMS but no questions or carId > should return estimate", async () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue