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 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,

View file

@ -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")
); );
} }
@ -84,7 +85,7 @@ export async function skipVinLookupNotRepair() {
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"

View file

@ -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 () => {