Merge pull request #3267 from Safelite/feature/CASH-3041

CASH-3041: Fix loading spinner
This commit is contained in:
Chris 2026-07-14 11:44:21 -04:00 committed by GitHub
commit ecdef34a4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 33 additions and 6 deletions

View file

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

View file

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