From eeae577458f5a8114d8e460a1b6db6da2ebbfdaa Mon Sep 17 00:00:00 2001 From: credelinghuys Date: Tue, 14 Jul 2026 10:55:43 -0400 Subject: [PATCH] CASH-3041: Fix loading spinner --- src/layouts/vin-lookup/vin-lookup.spec.js | 28 +++++++++++++++++++---- src/layouts/vin-lookup/vin-lookup.vue | 11 +++++++-- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/layouts/vin-lookup/vin-lookup.spec.js b/src/layouts/vin-lookup/vin-lookup.spec.js index 39b1108f2..439becc60 100644 --- a/src/layouts/vin-lookup/vin-lookup.spec.js +++ b/src/layouts/vin-lookup/vin-lookup.spec.js @@ -168,6 +168,23 @@ describe("vin-lookup.vue", () => { expect(wrapper.vm.navigateForward).not.toHaveBeenCalled(); }); + it("Should keep the continue button loader spinning for vinRequired vehicles when VIN lookup fails", async () => { + // Arrange + store.getters.vehicle.vinRequired = true; + const { wrapper } = setupMocks({}); + mockOutPromises({ vehicleLookupFailed: true }); + wrapper.vm.continueWithFailedVin = jest.fn().mockResolvedValue(); + wrapper.setData({ vin: "1HGCM82633A123456", vinPopulatedOnPageLoad: false }); + + // Act + await wrapper.vm.forwardButtonAction(); + + // Assert + expect(wrapper.vm.continueWithFailedVin).toHaveBeenCalled(); + expect(wrapper.vm.$refs.navbar.removeLoader).not.toHaveBeenCalled(); + store.getters.vehicle.vinRequired = false; + }); + describe("navigateForward", () => { test("carId is different from returned vehicle and selected glass isn't available => continue with different glass", async () => { // Arrange @@ -394,11 +411,14 @@ function setupMocks({ customMountOptions }) { return { wrapper }; } -function mockOutPromises({ carId, isZipValid = true, isZipServiceable = true }) { +function mockOutPromises({ + carId, + isZipValid = true, + isZipServiceable = true, + vehicleLookupFailed = false, +}) { const apiResponses = { - vehicleLookupResponse: { - carId: carId, - }, + vehicleLookupResponse: vehicleLookupFailed ? undefined : { carId: carId }, zipCodeData: { isValid: isZipValid, isServiceable: isZipServiceable, diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 35e2a626e..a8a700de0 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -295,7 +295,14 @@ export default { const isVinLookupRequired = this.$store.getters.vehicle.vinRequired; if (isVinLookupRequired) { this.requiredVinNotFound = true; - this.continueWithFailedVin(this.vin, resultMap.zipCodeData); + + // Check if Service Zip entered is serviceable, if not display an alert + if (!resultMap.zipCodeData.isServiceable) { + this.displayNonServiceableZipAlert = true; + } + + await this.continueWithFailedVin(this.vin, resultMap.zipCodeData); + return; } else { this.displayVinNotFoundAlert = true; } @@ -521,7 +528,7 @@ export default { }, false ); - this.navigateForwardWithSingleCarMatch(); + await this.navigateForwardWithSingleCarMatch(); }, getRequiredVinNotFound() { // Prevents success alert from showing