From aab32ef7b1fcc499a72c2a48274591c18474c19d Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 6 May 2022 16:12:56 -0400 Subject: [PATCH] Bug fixes, 1) added zipToDisplay datum for cases when registration zip entered is also not valid, 2) changed navigateAfterSaveToHeritageFunnel function to exported function as it is not in global and fixed unit tests with it. 3) Fixed updateServiceLocationZipCode name in vuex. --- .../license-plate-lookup/license-plate-lookup.spec.js | 6 +++--- .../license-plate-lookup/license-plate-lookup.vue | 9 +++++++-- src/store/index.js | 4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js index 609ddcf2e..6e86cd9f5 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js +++ b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js @@ -3,6 +3,7 @@ import licensePlateLookup from "@/layouts/license-plate-lookup/license-plate-loo // Supporting Files import { settleAllPromises } from "@/helpers/layout-helper.js"; +import * as navigateToHeritage from "@/helpers/heritage-integration/navigation-helper"; import baseMixin from "@/mixins/base-mixin"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { shallowMount, flushPromises } from "@vue/test-utils"; @@ -377,15 +378,14 @@ describe("license-plate-lookup.vue", () => { //Act wrapper.vm.isCarIdDifferent = false; - wrapper.vm.$router.navigateAfterSaveToHeritageFunnel = jest.fn(); wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => { return ''; }); - + navigateToHeritage.navigateAfterSaveToHeritageFunnel = jest.fn(); await wrapper.vm.navigateForward(); //Assert - expect(wrapper.vm.$router.navigateAfterSaveToHeritageFunnel).toHaveBeenCalled(); + expect(navigateToHeritage.navigateAfterSaveToHeritageFunnel).toHaveBeenCalled(); }); }); diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index 356a8ec9e..84b58e93d 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -61,6 +61,9 @@ import { import { errorMessages } from "@/constants/error-messages"; +import { + navigateAfterSaveToHeritageFunnel +} from "@/helpers/heritage-integration/navigation-helper"; import { getDamageString, isGlassAvailableForCarId, @@ -125,6 +128,7 @@ export default { previouslyEnteredCarId: "", customAlertData: {}, isSelectedGlassAvailableForVehicle: true, + zipToDisplay: this.getRegistrationZipFromStore(), }; }, mounted() { @@ -162,7 +166,7 @@ export default { let text = this.getCmsContent( "NoServiceZipWidget", "HeadlineText" - ).replaceAll("{custom:zip}", this.registrationZip); + ).replaceAll("{custom:zip}", this.zipToDisplay); return text; }, NoServiceZipBody() { @@ -214,6 +218,7 @@ export default { this.isVinValid = true; this.isRegistrationZipServicable = false; this.isCarIdDifferent = false; + this.zipToDisplay = this.serviceZip ? this.serviceZip : this.registrationZip; return; } @@ -265,7 +270,7 @@ export default { ); return; } else { - this.$router.navigateAfterSaveToHeritageFunnel(this.$route); + navigateAfterSaveToHeritageFunnel(this.$route); return; } }, diff --git a/src/store/index.js b/src/store/index.js index 75bd4807d..d570b5c4e 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -144,9 +144,9 @@ export const mutations = { updateRegistrationAddress(state, registrationAddress){ state.order.vehicle.registration.address = registrationAddress; }, - updateServiceLocationZip(state, serviceLocationZip){ + updateServiceLocationZipCode(state, serviceLocationZip){ state.order.vehicle.registration.zip = serviceLocationZip; - }, + }, updateRegistrationCity(state, serviceCity){ state.order.vehicle.registration.city = serviceCity; },