diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js
index dd84c8b35..1f6723470 100644
--- a/src/helpers/heritage-integration/navigation-helper.js
+++ b/src/helpers/heritage-integration/navigation-helper.js
@@ -56,6 +56,33 @@ export async function navigateToHeritageFunnel(shouldSaveSession = true) {
});
}
+export async function skipVinLookup() {
+ const isVinOptionalVehicle = store.getters.order.vehicle.make
+ ? await store.dispatch(storeActions.IS_VIN_OPTIONAL_VEHICLE)
+ : false;
+
+ return (
+ store.getters.damage.isRepair ||
+ isVinOptionalVehicle ||
+ experimentMixin.methods.hasSettingEqualTo(experimentSettings.SUPPRESS_VIN_CAPTURE, true)
+ );
+}
+
+export async function skipVinLookupNotRepair() {
+ const isVinOptionalVehicle = store.getters.order.vehicle.make
+ ? await store.dispatch(storeActions.IS_VIN_OPTIONAL_VEHICLE)
+ : false;
+
+ return (
+ !store.getters.damage.isRepair &&
+ (isVinOptionalVehicle ||
+ experimentMixin.methods.hasSettingEqualTo(
+ experimentSettings.SUPPRESS_VIN_CAPTURE,
+ true
+ ))
+ );
+}
+
/*
Logic for getting the last "valid" page a user visited.
*/
@@ -76,9 +103,7 @@ async function getLatestPageForRedirection() {
fmgPageValues.CAPABILITY_QUESTIONS
);
- const isVinOptionalVehicle = store.getters.order.vehicle.make
- ? await store.dispatch(storeActions.IS_VIN_OPTIONAL_VEHICLE)
- : false;
+ const skipVin = await skipVinLookup();
if (!vehicleMakeComponent.methods.arePagePrerequisitesValid()) {
return fmgPageValues.VEHICLE_YEAR;
@@ -102,12 +127,7 @@ async function getLatestPageForRedirection() {
} else if (
// capture vin
vinLookupComponent.methods.arePagePrerequisitesValid() &&
- !store.getters.damage.isRepair &&
- !isVinOptionalVehicle &&
- experimentMixin.methods.hasSettingEqualTo(
- experimentSettings.SUPPRESS_VIN_CAPTURE,
- false
- )
+ !skipVin
) {
return fmgPageValues.VIN_LOOKUP;
} else {
diff --git a/src/layouts/estimate/estimate.spec.js b/src/layouts/estimate/estimate.spec.js
index 3a0869828..1519f646d 100644
--- a/src/layouts/estimate/estimate.spec.js
+++ b/src/layouts/estimate/estimate.spec.js
@@ -219,40 +219,69 @@ describe("estimate.vue", () => {
});
});
-describe("skipVinLookup", () => {
+describe("test alertInfo and isRepair", () => {
const skipOptions = [
- [true, true, true, true],
- [true, false, false, true],
- [false, true, true, true],
- [false, false, false, false],
+ [true, false, "AlertQuoteReady"],
+ [false, true, "AlertQuoteVinOptional"],
+ [false, false, "AlertQuoteReady"],
+ [true, true, "AlertQuoteVinOptional"],
];
test.each(skipOptions)(
- "isRepair %s, isVinOptional %s and suppressVinCapture %s should return %s",
- async (isRepair, isVinOptionalVehicle, suppressVinCapture, expectedVinSkip) => {
+ "isRepair %s, skipVinNotRepair %s alertInfo should return %s",
+ async (isRepair, skipVinNotRepair, expectedAlertInfo) => {
const { wrapper } = setupMocks({});
await wrapper.setData({
- isVinOptionalVehicle: isVinOptionalVehicle,
+ skipVinNotRepair: skipVinNotRepair,
});
store.commit(storeMutations.UPDATE_IS_REPAIR, isRepair);
- const mockExperimentsList = [
- {
- universeName: "ConceptFunnel",
- settings: {
- SuppressVinCapture: suppressVinCapture,
- },
- },
- ];
- store.commit(storeMutations.UPDATE_EXPERIMENTS, mockExperimentsList);
- expect(wrapper.vm.skipVinLookup).toEqual(expectedVinSkip);
+ expect(wrapper.vm.alertInfo).toEqual(expectedAlertInfo);
+ expect(wrapper.vm.isRepair).toEqual(isRepair);
}
);
});
+describe("test skipVin Navigation", () => {
+ test("skipVin for repair ForwardButtonAction triggers a router.navigateWithSaving", async () => {
+ //Arrange
+ const { wrapper } = setupMocks({});
+ await wrapper.setData({
+ skipVin: true,
+ });
+
+ store.commit(storeMutations.UPDATE_IS_REPAIR, true);
+ store.commit(storeMutations.UPDATE_MAKE, "acura");
+
+ //Act
+ await wrapper.vm.forwardButtonAction();
+
+ //Assert
+ expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
+ });
+
+ test("skipVin for non-repair ForwardButtonAction triggers navigateForwardWithSingleCarMatch", async () => {
+ //Arrange
+ const { wrapper } = setupMocks({});
+ await wrapper.setData({
+ skipVin: true,
+ });
+ wrapper.vm.navigateForwardWithSingleCarMatch = jest.fn();
+
+ store.commit(storeMutations.UPDATE_IS_REPAIR, false);
+ store.commit(storeMutations.UPDATE_MAKE, "acura");
+
+ //Act
+ await wrapper.vm.forwardButtonAction();
+
+ //Assert
+ expect(wrapper.vm.navigateForwardWithSingleCarMatch).toHaveBeenCalledTimes(1);
+ });
+});
+
function setupMocks({
groupName = "estimate",
- isVinOptionalVehicle = false,
+ skipVin = false,
cmsQuestionText = "Let's get your VIN. Or we can look it up for you!",
cmsAnswers = [
{ Name: "Provide my VIN manually Most specific to your vehicle" },
@@ -284,7 +313,10 @@ function setupMocks({
mountOptions["attachTo"] = document.body;
const wrapper = shallowMount(estimate, mountOptions);
- wrapper.vm.isVinOptionalVehicle = isVinOptionalVehicle;
+ wrapper.vm.skipVin = skipVin;
+ wrapper.vm.getZipCodeData = jest
+ .fn()
+ .mockReturnValue({ isValid: true, isServiceable: true, state: "OH" });
return { wrapper, apiPromise };
}
diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue
index 9d31083d6..e032a3d9b 100644
--- a/src/layouts/estimate/estimate.vue
+++ b/src/layouts/estimate/estimate.vue
@@ -5,7 +5,7 @@