Fixed some issues caused by co-pilot changes.

This commit is contained in:
Jeremy-Z 2026-07-08 10:49:28 -04:00
parent e516aea577
commit ecfbfb9588
2 changed files with 18 additions and 27 deletions

View file

@ -402,7 +402,7 @@ describe('duplicateCheck.vue', () => {
expect(wrapper.vm.mainStore.getCoveragePolicyInfo).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1);
});
test('Load session throws error => still navigate forward', async () => {
test('Load session throws error => should bailout, should not navigate forward', async () => {
// Arrange
const selectedAnswer = getRandomString(6, 6);
const { wrapper } = getMountedComponent({
@ -431,7 +431,7 @@ describe('duplicateCheck.vue', () => {
expect(wrapper.vm.mainStore.loadSessionFromDuplicate).toHaveBeenCalledTimes(1);
expect(saveSession).not.toHaveBeenCalled();
expect(wrapper.vm.mainStore.getCoveragePolicyInfo).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigate).not.toHaveBeenCalledWith();
});
test('coverageType deductible and policy vehicles returned => CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES', async () => {
// Arrange

View file

@ -139,7 +139,6 @@ export default {
showIssLoadingModal(true);
let callSaveSession = false;
let selectedReferral = null;
// If user clicked forward without selecting an option or user click on "start a new claim" button.
if (this.selectedAnswer == null || this.selectedAnswer === 'NewClaim') {
@ -148,41 +147,33 @@ export default {
}
else
{
selectedReferral =
const selectedReferral =
this.mainStore.applicationUser.duplicateOrders.find((o) => o.correlationId === this.selectedAnswer);
if (!selectedReferral) {
if (selectedReferral) {
// LoadSession will bailout on error.
await this.mainStore.loadSessionFromDuplicate(selectedReferral);
}
else {
// If duplicate not found in list (unable to load), then call SaveSession to create referral.
callSaveSession = true;
}
}
// Call LoadSession if duplicate was found.
if (selectedReferral) {
try {
await this.mainStore.loadSessionFromDuplicate(selectedReferral);
}
catch (error) {
// LoadSession will bailout.
}
}
// Call SaveSession to create referral.
if (callSaveSession) {
try {
try
{
// Call SaveSession to create referral.
if ( callSaveSession ) {
// SaveSession will bailout on error.
await saveSession({ shouldAwaitSaveSessionQueue: true, bailoutOnError: true });
}
catch (error) {
// SaveSession will bailout.
}
}
// Call getCoveragePolicyInfo to get the policy info.
try {
// Call getCoveragePolicyInfo to get the policy info.
await this.mainStore.getCoveragePolicyInfo();
}
}
catch (error) {
// GetCoveragePolicyInfo handles exception / error internally.
// No error handling here needed.
// GetCoveragePolicyInfo handles exception / error internally. We do not care if it fails, user continues in unverified path.
}
this.pushEventToGA("policy_search", "policy_found", this.mainStore.isPolicyLookupSuccessful ? "Yes" : "No", true);