Changes after code reviewed by Mark

This commit is contained in:
Leah Schumann 2022-06-20 07:53:13 -04:00
parent 9c68844fdb
commit 5f155d53da
2 changed files with 12 additions and 14 deletions

View file

@ -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';

View file

@ -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,