Copilot changes
This commit is contained in:
parent
991ef0ebb2
commit
583a675fa3
8 changed files with 60 additions and 68 deletions
|
|
@ -97,7 +97,7 @@ export default {
|
|||
global.$logger.logError(`${method}: ${endpoint}: ${error.message}`, error.response);
|
||||
if (bailoutOnError && global.bailoutOnAxiosError !== undefined)
|
||||
{
|
||||
global.bailoutOnAxiosError({ url, error });
|
||||
global.bailoutOnAxiosError({ method, url, payload, error });
|
||||
}
|
||||
}
|
||||
return reject(error.response);
|
||||
|
|
|
|||
|
|
@ -605,7 +605,7 @@ describe('coverageStatement.vue', () => {
|
|||
wrapper.vm.cancelClaim();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.$router.navigateBailout).toHaveBeenCalled()
|
||||
expect(wrapper.vm.$router.navigateBailout).toHaveBeenCalled();
|
||||
});
|
||||
test('If No Comp and selected Safelite, navigate forward with CLICKED_FORWARD_WITH_SAFELITE scenario', () => {
|
||||
// Arrange
|
||||
|
|
@ -663,7 +663,7 @@ describe('coverageStatement.vue', () => {
|
|||
wrapper.vm.cancelClaim();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.$router.navigateBailout).toHaveBeenCalled()
|
||||
expect(wrapper.vm.$router.navigateBailout).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
describe('openCancelClaimModal', () => {
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ export default {
|
|||
|
||||
// We only call the ITAC pricing endpoint if we are not repair or we are NoComp
|
||||
if (!this.isRepair || this.mainStore.isNoComp) {
|
||||
const pricingResults = await useMainStore().getITACPriceOrderItems(availableLineItems)
|
||||
const pricingResults = await useMainStore().getITACPriceOrderItems(availableLineItems);
|
||||
this.setBaseServiceLineItems(pricingResults);
|
||||
}
|
||||
},
|
||||
|
|
@ -391,7 +391,7 @@ export default {
|
|||
this.mainStore.updateIsSafeliteProvider(true);
|
||||
this.navigateWithScenario(navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE);
|
||||
} else {
|
||||
this.$router.navigateBailout(bailoutMessage.coverageStatementInvalidState())
|
||||
this.$router.navigateBailout(bailoutMessage.coverageStatementInvalidState());
|
||||
}
|
||||
},
|
||||
navigateWithScenario(scenario) {
|
||||
|
|
@ -445,7 +445,7 @@ export default {
|
|||
},
|
||||
cancelClaim() {
|
||||
this.mainStore.updateIsSafeliteProvider(false);
|
||||
this.$router.navigateBailout(bailoutMessage.RequestCallback())
|
||||
this.$router.navigateBailout(bailoutMessage.RequestCallback());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ describe('policy-vehicles.vue', () => {
|
|||
async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
wrapper.vm.lookupVehicleByVin = jest.fn().mockReturnValue({ error: true, status: 404 });
|
||||
wrapper.vm.lookupVehicleByVin = jest.fn().mockRejectedValue({ isAxiosError: true, status: 404 });
|
||||
|
||||
const vin = getRandomString(17, 17);
|
||||
await wrapper.setData({
|
||||
|
|
|
|||
|
|
@ -151,26 +151,26 @@ export default {
|
|||
if (value === vehicleSelectionOptions.VEHICLE_NOT_LISTED) {
|
||||
// clear previously selected vehicle and image
|
||||
this.mainStore.resetVehicleState();
|
||||
} else {
|
||||
// get vehicle details from selected VIN
|
||||
try {
|
||||
const vehicle = await this.lookupVehicleByVin(value);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!vehicle?.data.canSafeliteService) {
|
||||
this.displayNoServiceAlert = true;
|
||||
return;
|
||||
}
|
||||
if (vehicle) {
|
||||
// save selected vehicle to the store
|
||||
useMainStore().updateVehicle({
|
||||
...vehicle.data,
|
||||
policyVehicleId: this.selectedPolicyVehicle?.id,
|
||||
vin: value
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
this.mainStore.resetVehicleState();
|
||||
// get vehicle details from selected VIN
|
||||
try {
|
||||
const vehicle = await this.lookupVehicleByVin(value);
|
||||
if (!vehicle?.data.canSafeliteService) {
|
||||
this.displayNoServiceAlert = true;
|
||||
return;
|
||||
}
|
||||
if (vehicle) {
|
||||
// save selected vehicle to the store
|
||||
useMainStore().updateVehicle({
|
||||
...vehicle.data,
|
||||
policyVehicleId: this.selectedPolicyVehicle?.id,
|
||||
vin: value
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
this.mainStore.resetVehicleState();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -190,29 +190,16 @@ export default {
|
|||
);
|
||||
},
|
||||
async forwardButtonAction() {
|
||||
if (this.selectedVehicleVin !== vehicleSelectionOptions.VEHICLE_NOT_LISTED) {
|
||||
if (this.selectedVehicleVin === vehicleSelectionOptions.VEHICLE_NOT_LISTED) {
|
||||
useMainStore().updateCoverageType(coverageType.NONE);
|
||||
useMainStore().updateCoverageStatus(coverageStatuses.NO_COVERAGE);
|
||||
this.navigateForward();
|
||||
return;
|
||||
}
|
||||
|
||||
const vehicle = this.policyVehicles.find((pv) => pv.vin === this.selectedVehicleVin);
|
||||
try {
|
||||
const vehicleLookupResponse = await this.lookupVehicleByVin(this.selectedVehicleVin);
|
||||
const vehicle = this.policyVehicles.find((pv) => pv.vin === this.selectedVehicleVin);
|
||||
|
||||
if (vehicleLookupResponse.error) {
|
||||
if (vehicleLookupResponse.status === 404) {
|
||||
this.mainStore.resetVehicleState();
|
||||
useMainStore().updateVehicle({
|
||||
policyVehicleId: vehicle.id,
|
||||
carId: '0',
|
||||
category: '',
|
||||
year: vehicle.vehicleYear || '',
|
||||
make: vehicle.vehicleMake || '',
|
||||
model: vehicle.vehicleModel || '',
|
||||
style: vehicle.vehicleStyle || '',
|
||||
vin: vehicle.vin
|
||||
});
|
||||
this.policyVinFound = false;
|
||||
return this.navigateForward();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
useMainStore().updateVehicle({
|
||||
...vehicleLookupResponse.data,
|
||||
|
|
@ -225,11 +212,28 @@ export default {
|
|||
repairWaived: this.repairWaivedForSelectedVehicle,
|
||||
endorsements: this.endorsementsForSelectedVehicle
|
||||
});
|
||||
} else {
|
||||
useMainStore().updateCoverageType(coverageType.NONE);
|
||||
useMainStore().updateCoverageStatus(coverageStatuses.NO_COVERAGE);
|
||||
this.navigateForward();
|
||||
} catch (e) {
|
||||
debugger;
|
||||
if (e.isAxiosError && e.status === 404) {
|
||||
this.mainStore.resetVehicleState();
|
||||
useMainStore().updateVehicle({
|
||||
policyVehicleId: vehicle.id,
|
||||
carId: '0',
|
||||
category: '',
|
||||
year: vehicle.vehicleYear || '',
|
||||
make: vehicle.vehicleMake || '',
|
||||
model: vehicle.vehicleModel || '',
|
||||
style: vehicle.vehicleStyle || '',
|
||||
vin: vehicle.vin
|
||||
});
|
||||
this.policyVinFound = false;
|
||||
this.navigateForward();
|
||||
return;
|
||||
}
|
||||
|
||||
throw e;
|
||||
}
|
||||
return this.navigateForward();
|
||||
},
|
||||
navigateForward() {
|
||||
if (this.selectedVehicleVin === vehicleSelectionOptions.VEHICLE_NOT_LISTED) {
|
||||
|
|
@ -264,15 +268,7 @@ export default {
|
|||
}
|
||||
},
|
||||
async lookupVehicleByVin(vin) {
|
||||
try {
|
||||
return await useMainStore().lookupVehicleByVin(vin);
|
||||
} catch (responseError) {
|
||||
return {
|
||||
error: true,
|
||||
status: responseError.status,
|
||||
data: responseError.data
|
||||
};
|
||||
}
|
||||
return useMainStore().lookupVehicleByVin(vin);
|
||||
},
|
||||
async addAnotherVehicle() {
|
||||
this.selectedVehicleVin = vehicleSelectionOptions.VEHICLE_NOT_LISTED;
|
||||
|
|
|
|||
|
|
@ -328,8 +328,7 @@ export default {
|
|||
}
|
||||
promises.push(this.mainStore.getCoveragePolicyInfo());
|
||||
await Promise.all(promises);
|
||||
await saveSession({shouldAwaitSaveSessionQueue: true})
|
||||
.catch((error) => this.mainStore.setBailout(bailoutMessage.saveSessionError(error)));
|
||||
await saveSession({ shouldAwaitSaveSessionQueue: true, bailoutOnError: true })
|
||||
this.navigateForward();
|
||||
},
|
||||
async configureZip() {
|
||||
|
|
|
|||
|
|
@ -48,6 +48,6 @@ describe('Router', () => {
|
|||
|
||||
// Assert
|
||||
expect(router.push.mock.calls[0][0].query.issPage).toBe(issPageValues.BAILOUT_PAGE);
|
||||
expect(useMainStore().isBailout).toBeTruthy()
|
||||
expect(useMainStore().isBailout).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -541,7 +541,7 @@ export const useMainStore = defineStore({
|
|||
|
||||
if (!issConfig.isCoverageEnabled || applicationUser.coverageLookupAttempts > 10) {
|
||||
this.updateCoverageType(coverageType.NONE);
|
||||
return Promise.resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
this.applicationUser.coverageAttempts += 1;
|
||||
|
|
@ -1198,9 +1198,6 @@ export const useMainStore = defineStore({
|
|||
IsOEMRequest: this.hasOemEndorsement
|
||||
}
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.error(error);
|
||||
throw error;
|
||||
});
|
||||
|
||||
const { lineItems, serverData, isItac, primaryBillToNumber, partsWerePriced, isItacOptimized } = response.data;
|
||||
|
|
@ -2442,7 +2439,7 @@ export const useMainStore = defineStore({
|
|||
populateInitialState(forceReset) {
|
||||
if (!sessionStorage.getItem(storeId) || forceReset) {
|
||||
this.$state = getDefaultState();
|
||||
sessionStorage.removeItem(webStorageConstants.SUBMITTED_ORDER);
|
||||
this.resetSubmittedOrder();
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue