commit
38e44915bb
3 changed files with 14 additions and 2 deletions
|
|
@ -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,14 @@ 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,
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
||||
|
|
@ -73,6 +74,7 @@ export async function skipVinLookup() {
|
|||
return (
|
||||
store.getters.damage.isRepair ||
|
||||
isVinOptionalVehicle ||
|
||||
!hasWindshield() ||
|
||||
experimentMixin.methods.hasSettingEqualTo(experimentSettings.SUPPRESS_VIN_CAPTURE, "true")
|
||||
);
|
||||
}
|
||||
|
|
@ -85,6 +87,7 @@ export async function skipVinLookupNotRepair() {
|
|||
return (
|
||||
!store.getters.damage.isRepair &&
|
||||
(isVinOptionalVehicle ||
|
||||
!hasWindshield() ||
|
||||
experimentMixin.methods.hasSettingEqualTo(
|
||||
experimentSettings.SUPPRESS_VIN_CAPTURE,
|
||||
"true"
|
||||
|
|
|
|||
|
|
@ -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 () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue