diff --git a/src/layouts/vin-lookup/vin-lookup.spec.js b/src/layouts/vin-lookup/vin-lookup.spec.js index e782f345e..d910c90fd 100644 --- a/src/layouts/vin-lookup/vin-lookup.spec.js +++ b/src/layouts/vin-lookup/vin-lookup.spec.js @@ -153,6 +153,7 @@ describe("vin-lookup.vue", () => { const zipPromise = Promise.resolve(zipValidationApiResponse); wrapper.vm.validateZip = jest.fn().mockImplementation(() => zipPromise); + wrapper.vm.setupUiForNonServiceableZip = jest.fn(); wrapper.vm.navigateForward = jest.fn(); wrapper.vm.previouslyEnteredCarId = 'new carId'; diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 392cde7f1..b52200dd4 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -323,19 +323,15 @@ export default { const vehicleLookup = this.lookupVehicle(vinToLookup); zipValidationResponse = await zipValidation; - vehicleLookupResponse = await vehicleLookup.catch((response) => { - if (response.status == StatusCodes.NOT_FOUND) { - this.vinNotFound = true; - this.$refs.funnelFooter.removeLoader(); - return false; - } + vehicleLookupResponse = await vehicleLookup.catch(() => { + this.vinNotFound = true; + this.$refs.funnelFooter.removeLoader(); + return false; }); // Check if Service Zip entered is servicable, if not display an alert if (!zipValidationResponse.data.isServiceable) { - this.customAlertData.zip = this.zip; - this.noServiceZip = true; - this.invalidZip = this.zip; + this.setupUiForNonServiceableZip(this.zip); } if (!vehicleLookupResponse || !zipValidationResponse.data.isServiceable) { @@ -347,13 +343,9 @@ export default { // Check if Service Zip entered is serviceable, if not display an alert if (!zipValidationResponse.data.isServiceable) { - this.customAlertData.zip = this.zip; - this.noServiceZip = true; - this.invalidZip = this.zip; + this.setupUiForNonServiceableZip(this.zip); this.$refs.funnelFooter.removeLoader(); - return; - } else { this.navigateForward(); return; @@ -420,6 +412,11 @@ export default { store.commit(storeMutations.UPDATE_SERVICE_LOCATION_STATE, zipInfo.state); store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.email); }, + setupUiForNonServiceableZip(zip) { + this.customAlertData.zip = zip; + this.invalidZip = zip; + this.noServiceZip = true; + }, }, components: { Form,