Send user to estimate/vin-lookup if verified + going to quote/insurance

This commit is contained in:
Chloe Herd 2024-03-20 14:59:06 -04:00
parent 71abfc1d90
commit 79f9d3cfc2
2 changed files with 89 additions and 29 deletions

View file

@ -31,8 +31,8 @@ export async function getDirectNavigation(toRoute) {
// Verified insurance users need to be routed around some pages
// vehicle -> vehicle-damage
// quote -> heritage
// insurance-company -> heritage
// quote -> vin-lookup/estimate
// insurance-company -> vin-lookup/estimate
if (store.getters.payment.insuranceCoverage.isVerified) {
if (fmgPageValue === fmgPageValues.VEHICLE) {
return fmgPageValues.VEHICLE_DAMAGE;
@ -42,7 +42,13 @@ export async function getDirectNavigation(toRoute) {
fmgPageValue === fmgPageValues.QUOTE ||
fmgPageValue === fmgPageValues.INSURANCE_COMPANY
) {
return fmgPageValues.HERITAGE;
const skipVin = await skipVinLookup();
if (skipVin) {
return fmgPageValues.ESTIMATE;
} else {
return fmgPageValues.VIN_LOOKUP;
}
}
}

View file

@ -8,6 +8,8 @@ import { externalUrls } from "@/router/router-constants/externalUrl-values";
import { queryStrings } from "@/constants/query-strings";
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
import { damageLocationsSelected as glassLocations } from "@/constants/damage-locations-selected";
import store from "@/store";
import router from "@/router";
@ -377,38 +379,90 @@ describe("getPageToRouteExistingOrderTo", () => {
expect(result).toBe(fmgPageValues.VEHICLE_DAMAGE);
});
test("Replace navigation to `quote` with `heritage`", async () => {
// Arrange
const toRoute = {
query: {
fmgPage: fmgPageValues.QUOTE,
},
};
describe("Vin-Exempt", () => {
test("Replace navigation to `quote` with `estimate`", async () => {
// Arrange
const toRoute = {
query: {
fmgPage: fmgPageValues.QUOTE,
},
};
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true);
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true);
store.commit(storeMutations.UPDATE_IS_REPAIR, true);
store.commit(storeMutations.UPDATE_MAKE, "acura");
// Act
const result = await getPageToRouteExistingOrderTo(toRoute);
// Act
const result = await getPageToRouteExistingOrderTo(toRoute);
// Assert
expect(result).toBe(fmgPageValues.HERITAGE);
// Assert
expect(result).toBe(fmgPageValues.ESTIMATE);
});
test("Replace navigation to `insurance-company` with `estimate`", async () => {
// Arrange
const toRoute = {
query: {
fmgPage: fmgPageValues.INSURANCE_COMPANY,
},
};
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true);
store.commit(storeMutations.UPDATE_IS_REPAIR, true);
store.commit(storeMutations.UPDATE_MAKE, "acura");
// Act
const result = await getPageToRouteExistingOrderTo(toRoute);
// Assert
expect(result).toBe(fmgPageValues.ESTIMATE);
});
});
test("Replace navigation to `insurance-company` with `heritage`", async () => {
// Arrange
const toRoute = {
query: {
fmgPage: fmgPageValues.INSURANCE_COMPANY,
},
};
describe("Vin-Required", () => {
test("Replace navigation to `quote` with `vin-lookup`", async () => {
// Arrange
const toRoute = {
query: {
fmgPage: fmgPageValues.QUOTE,
},
};
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true);
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true);
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
store.commit(storeMutations.UPDATE_MAKE, "acura");
store.commit(storeMutations.UPDATE_GLASS_TO_REPLACE, [
{ glassLocation: glassLocations.WINDSHIELD },
]);
// Act
const result = await getPageToRouteExistingOrderTo(toRoute);
// Act
const result = await getPageToRouteExistingOrderTo(toRoute);
// Assert
expect(result).toBe(fmgPageValues.HERITAGE);
// Assert
expect(result).toBe(fmgPageValues.VIN_LOOKUP);
});
test("Replace navigation to `insurance-company` with `vin-lookup`", async () => {
// Arrange
const toRoute = {
query: {
fmgPage: fmgPageValues.INSURANCE_COMPANY,
},
};
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true);
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
store.commit(storeMutations.UPDATE_MAKE, "acura");
store.commit(storeMutations.UPDATE_GLASS_TO_REPLACE, [
{ glassLocation: glassLocations.WINDSHIELD },
]);
// Act
const result = await getPageToRouteExistingOrderTo(toRoute);
// Assert
expect(result).toBe(fmgPageValues.VIN_LOOKUP);
});
});
});
@ -430,7 +484,7 @@ describe("getPageToRouteExistingOrderTo", () => {
expect(result).toBe(fmgPageValues.VEHICLE);
});
test("Don't replace navigation to `quote` with `heritage`", async () => {
test("Don't replace navigation to `quote` with `estimate` or `vin-lookup`", async () => {
// Arrange
const toRoute = {
query: {
@ -447,7 +501,7 @@ describe("getPageToRouteExistingOrderTo", () => {
expect(result).toBe(fmgPageValues.QUOTE);
});
test("Don't replace navigation to `insurance-company` with `heritage`", async () => {
test("Don't replace navigation to `insurance-company` with `estimate` or `vin-lookup`", async () => {
// Arrange
const toRoute = {
query: {