Merge pull request #3235 from Safelite/feature/CASH-2942
CASH-2942: Always bailout for VIN required vehicles
This commit is contained in:
commit
e5a4830993
4 changed files with 42 additions and 1 deletions
|
|
@ -65,6 +65,9 @@ export async function skipVinLookup() {
|
|||
if (store.getters.damage.isRepair) {
|
||||
return true;
|
||||
}
|
||||
if (store.getters.vehicle.vinRequired) {
|
||||
return false;
|
||||
}
|
||||
const isVinOptionalVehicle = store.getters.order.vehicle.make
|
||||
? await store.dispatch(storeActions.IS_VIN_OPTIONAL_VEHICLE)
|
||||
: false;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import { damageLocationsSelected as glassLocations } from "@/constants/damage-lo
|
|||
|
||||
import store from "@/store";
|
||||
import router from "@/router";
|
||||
import { skipVinLookup } from "@/helpers/heritage-integration/navigation-helper";
|
||||
|
||||
const getPageToRouteExistingOrderTo = navigationHelper.getPageToRouteExistingOrderTo;
|
||||
const navigateToHeritageFunnel = navigationHelper.navigateToHeritageFunnel;
|
||||
|
|
@ -147,6 +148,20 @@ describe("navigateToHeritageFunnel", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("skipVinLookup", () => {
|
||||
afterEach(() => {
|
||||
store.commit(storeMutations.UPDATE_VIN_REQUIRED, false);
|
||||
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
|
||||
});
|
||||
|
||||
test("returns false when vehicle vin is required", async () => {
|
||||
store.commit(storeMutations.UPDATE_VIN_REQUIRED, true);
|
||||
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
|
||||
|
||||
await expect(skipVinLookup()).resolves.toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* `arePagePrerequisitesValidObject` is an object where the keys are fmgPageValue names and the values are booleans that indicate
|
||||
* whether arePagePrerequisitesValid is true or false
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ export default {
|
|||
pageNameToLog: pageName,
|
||||
});
|
||||
|
||||
if (result.PartNotFound) {
|
||||
if (result.PartNotFound || store.getters.vehicle.vinRequired) {
|
||||
return bailoutMixin.methods.navigateToBailoutPage(
|
||||
this,
|
||||
bailoutCodes.PART_NOT_FOUND
|
||||
|
|
|
|||
|
|
@ -3,6 +3,10 @@ import { shallowMount } from "@vue/test-utils";
|
|||
import { setupMocksForJsFiles, getMountOptions } from "@/helpers/unit-test-helper.js";
|
||||
import { storeActions } from "@/constants/store-actions";
|
||||
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
||||
import bailoutMixin from "@/mixins/bailout-mixin";
|
||||
import { bailoutCodes } from "@/constants/bailout-codes";
|
||||
import store from "@/store";
|
||||
import { storeMutations } from "@/constants/store-mutations";
|
||||
|
||||
jest.mock("@/helpers/heritage-integration/navigation-helper", () => ({
|
||||
navigateForward: jest.fn(),
|
||||
|
|
@ -15,6 +19,7 @@ jest.mock("@/helpers/heritage-integration/order-helper.js", () => ({
|
|||
describe("vin-pages-mixin", () => {
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
store.commit(storeMutations.UPDATE_VIN_REQUIRED, false);
|
||||
});
|
||||
|
||||
describe("navigateForwardWithSingleCarMatch", () => {
|
||||
|
|
@ -29,6 +34,24 @@ describe("vin-pages-mixin", () => {
|
|||
// Assert
|
||||
expect(vehicleQuestionsMixin.methods.navigateForward).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("vinRequired vehicles navigate to bailout after VIN is saved", async () => {
|
||||
// Arrange
|
||||
store.commit(storeMutations.UPDATE_VIN_REQUIRED, true);
|
||||
const { wrapper } = setupMocks({});
|
||||
bailoutMixin.methods.navigateToBailoutPage = jest.fn();
|
||||
vehicleQuestionsMixin.methods.navigateForward = jest.fn();
|
||||
|
||||
// Act
|
||||
await wrapper.vm.navigateForwardWithSingleCarMatch();
|
||||
|
||||
// Assert
|
||||
expect(bailoutMixin.methods.navigateToBailoutPage).toHaveBeenCalledWith(
|
||||
wrapper.vm,
|
||||
bailoutCodes.PART_NOT_FOUND
|
||||
);
|
||||
expect(vehicleQuestionsMixin.methods.navigateForward).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue