From ecfbfb9588625cbfed239f768c84797afc4c475e Mon Sep 17 00:00:00 2001 From: Jeremy-Z Date: Wed, 8 Jul 2026 10:49:28 -0400 Subject: [PATCH] Fixed some issues caused by co-pilot changes. --- .../duplicate-check/duplicate-check.spec.js | 4 +- .../duplicate-check/duplicate-check.vue | 41 ++++++++----------- 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/src/layouts/duplicate-check/duplicate-check.spec.js b/src/layouts/duplicate-check/duplicate-check.spec.js index 40d350d8..fc58e758 100644 --- a/src/layouts/duplicate-check/duplicate-check.spec.js +++ b/src/layouts/duplicate-check/duplicate-check.spec.js @@ -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 diff --git a/src/layouts/duplicate-check/duplicate-check.vue b/src/layouts/duplicate-check/duplicate-check.vue index ef68050f..f8e6144f 100644 --- a/src/layouts/duplicate-check/duplicate-check.vue +++ b/src/layouts/duplicate-check/duplicate-check.vue @@ -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);