If there is no windshield selected then do not require a vin lookup
This commit is contained in:
CarlNation 2023-04-21 10:14:35 -04:00
parent 024f2ab30e
commit e316378d2c
3 changed files with 12 additions and 5 deletions

View file

@ -1,6 +1,7 @@
import store from "@/store";
import baseMixin from "@/mixins/base-mixin.js";
import { storeActions } from "@/constants/store-actions";
import { damageLocationsSelected as glassLocations } from "@/constants/damage-locations-selected";
export function getDamageString() {
// If it's a repair it's always a windshield.
@ -45,6 +46,11 @@ export function getIsWindshieldOnly() {
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) {
const newGlassOptions = await baseMixin.methods.dispatchStoreAction(
storeActions.GET_DAMAGE_OPTIONS,

View file

@ -7,6 +7,7 @@ import { storeActions } from "@/constants/store-actions.js";
import { settleAllPromises } from "@/helpers/layout-helper";
import experimentMixin from "@/mixins/experiment-mixin";
import { experimentSettings } from "@/constants/experiments";
import { hasWindshield } from "@/helpers/damage-helper";
import store from "@/store";
import router from "@/router";
@ -72,7 +73,7 @@ export async function skipVinLookup() {
return (
store.getters.damage.isRepair ||
isVinOptionalVehicle ||
isVinOptionalVehicle || !hasWindshield() ||
experimentMixin.methods.hasSettingEqualTo(experimentSettings.SUPPRESS_VIN_CAPTURE, "true")
);
}
@ -83,8 +84,8 @@ export async function skipVinLookupNotRepair() {
: false;
return (
!store.getters.damage.isRepair &&
(isVinOptionalVehicle ||
!store.getters.damage.isRepair &&
(isVinOptionalVehicle || !hasWindshield() ||
experimentMixin.methods.hasSettingEqualTo(
experimentSettings.SUPPRESS_VIN_CAPTURE,
"true"

View file

@ -135,7 +135,7 @@ describe("getPageToRouteExistingOrderTo", () => {
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
const toRoute = {
query: {},
@ -172,7 +172,7 @@ describe("getPageToRouteExistingOrderTo", () => {
const result = await getPageToRouteExistingOrderTo(toRoute, false);
//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 () => {