From a419a9e9177c2ad9d00084c2a83747f18dc04ff4 Mon Sep 17 00:00:00 2001 From: Michaela Brydon Date: Wed, 24 Apr 2024 14:06:15 -0400 Subject: [PATCH 1/3] Making no comp show unverified when expected --- .../cart-dropdown/cart-dropdown.spec.js | 100 ++++++++++++------ .../cart-dropdown/cart-dropdown.vue | 19 ++-- .../coverage-statement/coverage-statement.vue | 1 - 3 files changed, 72 insertions(+), 48 deletions(-) diff --git a/src/iss-components/cart-dropdown/cart-dropdown.spec.js b/src/iss-components/cart-dropdown/cart-dropdown.spec.js index ed02ba8a..8fdc9898 100644 --- a/src/iss-components/cart-dropdown/cart-dropdown.spec.js +++ b/src/iss-components/cart-dropdown/cart-dropdown.spec.js @@ -123,9 +123,7 @@ describe('cart-dropdown component', () => { const storeData = { order: { payment: { - insuranceCoverage: { - coverageStatus: coverageStatuses.PENDING - } + insuranceCoverage: { isVerified: true } }, policy: { isITAC: false @@ -147,14 +145,18 @@ describe('cart-dropdown component', () => { const initialData = { isExpanded }; const storeData = { order: { + currentDeductible: 0, + lineItems: { }, payment: { - insuranceCoverage: { - coverageStatus: coverageStatuses.PENDING - } + insuranceCoverage: { isVerified: true } }, policy: { - isITAC: true + isITAC: true, + policyLookupSuccessful: true } + }, + issConfig: { + isClaimRegistrationRequired: true } }; const { wrapper } = getMountedComponent(storeData, {}, initialData); @@ -296,14 +298,18 @@ describe('cart-dropdown component', () => { const initialData = { isExpanded }; const storeData = { order: { + currentDeductible: 0, + lineItems: { }, payment: { - insuranceCoverage: { - coverageStatus: coverageStatuses.PENDING - } + insuranceCoverage: { isVerified: true } }, policy: { - isITAC: true + isITAC: true, + policyLookupSuccessful: true } + }, + issConfig: { + isClaimRegistrationRequired: true } }; const { wrapper } = getMountedComponent(storeData, {}, initialData); @@ -322,9 +328,7 @@ describe('cart-dropdown component', () => { const storeData = { order: { payment: { - insuranceCoverage: { - coverageStatus: coverageStatuses.PENDING - } + insuranceCoverage: { isVerified: true } }, policy: { isITAC: false @@ -636,7 +640,9 @@ describe('cart-dropdown component', () => { const storeData = { order: { policy: { - policyLookupSuccessful: true + policyLookupSuccessful: true, + noCoverage: false, + isITAC: false }, currentDeductible: 250, lineItems: { @@ -652,13 +658,7 @@ describe('cart-dropdown component', () => { vaps: null }, payment: { - insuranceCoverage: { - coverageStatus: coverageStatuses.VERIFIED - } - }, - policy: { - noCoverage: false, - isITAC: false + insuranceCoverage: { isVerified: true } } }, issConfig: { @@ -696,9 +696,7 @@ describe('cart-dropdown component', () => { ] }, payment: { - insuranceCoverage: { - coverageStatus: coverageStatuses.VERIFIED - } + insuranceCoverage: { isVerified: true } } }, issConfig: { @@ -1761,12 +1759,12 @@ describe('cart-dropdown component', () => { const storeData = { order: { payment: { - insuranceCoverage: { - coverageStatus: coverageStatuses.PENDING - } + insuranceCoverage: { isVerified: true } }, policy: { - isITAC: true + isITAC: true, + noCoverage: false, + policyLookupSuccessful: true }, currentDeductible: 321 } @@ -1782,15 +1780,22 @@ describe('cart-dropdown component', () => { // Assert expect(result).toBe(dollarAmount); }); - test('returns dollar amount when no comp', () => { + test('returns dollar amount when no comp and enableNoCompQuotes true', () => { // Arrange const storeData = { order: { + payment: { + insuranceCoverage: { isVerified: true } + }, policy: { isITAC: false, - noCoverage: true + noCoverage: true, + policyLookupSuccessful: true }, currentDeductible: 321 + }, + issConfig: { + enableNoCompQuote: true } }; const { wrapper } = getMountedComponent(storeData); @@ -1804,21 +1809,46 @@ describe('cart-dropdown component', () => { // Assert expect(result).toBe(dollarAmount); }); + test('returns "Verifying Coverage" when no comp and enableNoCompQuotes false', () => { + // Arrange + const storeData = { + order: { + payment: { + insuranceCoverage: { isVerified: true } + }, + policy: { + isITAC: false, + noCoverage: true, + policyLookupSuccessful: true + }, + currentDeductible: 321 + }, + issConfig: { + enableNoCompQuote: false + } + }; + const { wrapper } = getMountedComponent(storeData); + const amount = 123; + + // Act + const result = wrapper.vm.getDisplayed(amount); + + // Assert + expect(result).toBe(VERIFYING_COVERAGE); + }); test('returns dollar amount when deductible set, not itac, not no comp, and verified', () => { // Arrange const storeData = { order: { policy: { isITAC: false, - isNoComp: false, + noCoverage: false, policyLookupSuccessful: true }, currentDeductible: 321, policyLookupSuccessful: true, payment: { - insuranceCoverage: { - coverageStatus: coverageStatuses.VERIFIED - } + insuranceCoverage: { isVerified: true } } } }; diff --git a/src/iss-components/cart-dropdown/cart-dropdown.vue b/src/iss-components/cart-dropdown/cart-dropdown.vue index 662108f8..1831ba68 100644 --- a/src/iss-components/cart-dropdown/cart-dropdown.vue +++ b/src/iss-components/cart-dropdown/cart-dropdown.vue @@ -211,7 +211,8 @@ export default { return this.submittedOrder ? this.submittedOrder.currentDeductible : useMainStore().order.currentDeductible; }, showDeductibleCartItem() { - return !this.isNoComp && !this.isITAC; + const { isUnverified } = useMainStore(); + return isUnverified || (!this.isNoComp && !this.isITAC); }, lineItems() { return this.submittedOrder ? this.submittedOrder.lineItems : useMainStore().lineItems; @@ -232,19 +233,13 @@ export default { baseServicePrice() { return getPriceOfLineItems(this.baseServiceLineItems) ?? 0; }, - isVerifiedCoverageStatus() { - return this.submittedOrder ? this.submittedOrder.payment.insuranceCoverage.isVerified : useMainStore().isVerifiedCoverageStatus; - }, - isUnverified() { - return !this.isNoComp && !this.isITAC - && (this.deductible == null || !this.isVerifiedCoverageStatus); - }, isITAC() { return this.submittedOrder ? this.submittedOrder.policy.isITAC : useMainStore().isITAC; }, isNoComp() { return this.submittedOrder ? this.submittedOrder.policy.noCoverage : useMainStore().isNoComp; }, + // TODO fix rounding subTotal() { const { supportingItems, glassParts, otherParts, vaps, mobileFee } = this.lineItems; const allLineItems = [ @@ -270,13 +265,14 @@ export default { return result; }, salesTax() { + const { isUnverified } = useMainStore(); function sumTax(lineItems) { return lineItems?.reduce((accumulator, lineItem) => accumulator + (lineItem.salesTax ?? 0), 0) ?? 0; } let result = 0; - if (!this.isUnverified) { + if (!isUnverified) { if (this.isITAC || this.isNoComp) { result += sumTax(this.baseServiceLineItems); } else { @@ -451,9 +447,8 @@ export default { this.isExpanded = !this.isExpanded; }, getDisplayed(amount) { - return this.isUnverified - && !this.isNoComp - && !this.isITAC + const { isUnverified } = useMainStore(); + return isUnverified ? VERIFYING_COVERAGE : formatAmountInDollars(amount); }, diff --git a/src/layouts/coverage-statement/coverage-statement.vue b/src/layouts/coverage-statement/coverage-statement.vue index 0d0df331..68c2df90 100644 --- a/src/layouts/coverage-statement/coverage-statement.vue +++ b/src/layouts/coverage-statement/coverage-statement.vue @@ -381,7 +381,6 @@ export default { && policyVehicleId >= 0 && isClaimRegistrationRequired && !isClaimAlreadyRegistered - && !this.isNoCompQuoteVisible ); } }, From f9aa447f6bb10e1506f5fcee77b1f1bd0d363443 Mon Sep 17 00:00:00 2001 From: Michaela Brydon Date: Wed, 24 Apr 2024 14:54:28 -0400 Subject: [PATCH 2/3] Fixing test --- .../coverage-statement.spec.js | 16 +--------------- src/store/index.js | 4 ++++ 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/layouts/coverage-statement/coverage-statement.spec.js b/src/layouts/coverage-statement/coverage-statement.spec.js index 2dd9e3f7..e47df660 100644 --- a/src/layouts/coverage-statement/coverage-statement.spec.js +++ b/src/layouts/coverage-statement/coverage-statement.spec.js @@ -774,8 +774,7 @@ describe('coverageStatement.vue-working', () => { order: { payment: { insuranceCoverage: { - claimNumber: null, - isVerified: true // Added + claimNumber: null } }, policy: { @@ -854,19 +853,6 @@ describe('coverageStatement.vue-working', () => { // Assert expect(result).toBeFalsy(); }); - test('returns false when no comp', () => { - // Arrange - const mainInitialState = shouldRegisterClaimStoreStateItac; - mainInitialState.order.policy.noCoverage = true; - const { wrapper } = getMountedComponent(mainInitialState); - - // Act - const result = wrapper.vm.shouldRegisterClaim; - - // Assert - expect(result).toBeFalsy(); - }); - test('returns false when insuranceCoverage not verified', () => {}); describe('returns true when policy lookup success, vehicleId set to %p, claim reg req, claim not yet reg', () => { test('and itac', () => { // Arrange diff --git a/src/store/index.js b/src/store/index.js index 4b7502f8..9553c6bb 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -289,15 +289,19 @@ export const useMainStore = defineStore({ const { policyLookupSuccessful } = policy; const registerClaimSuccessful = !!payment.insuranceCoverage.isVerified; if (!policyLookupSuccessful) { + console.log('policy fail'); return true; } if (s.isNoComp && !s.issConfig.enableNoCompQuote) { + console.log('no comp not enabled'); return true; } if (!s.isNoComp && currentDeductible == null) { + console.log('null deductible'); return true; } if (s.isClaimRegistrationRequired && !registerClaimSuccessful) { + console.log('claim reg required but failed'); return true; } return false; From b0bdc70dd75682bfe3d7cfb58dbff2aaf2ff9554 Mon Sep 17 00:00:00 2001 From: Michaela Brydon Date: Thu, 25 Apr 2024 11:12:43 -0400 Subject: [PATCH 3/3] Remove console logs --- src/store/index.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 9553c6bb..4b7502f8 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -289,19 +289,15 @@ export const useMainStore = defineStore({ const { policyLookupSuccessful } = policy; const registerClaimSuccessful = !!payment.insuranceCoverage.isVerified; if (!policyLookupSuccessful) { - console.log('policy fail'); return true; } if (s.isNoComp && !s.issConfig.enableNoCompQuote) { - console.log('no comp not enabled'); return true; } if (!s.isNoComp && currentDeductible == null) { - console.log('null deductible'); return true; } if (s.isClaimRegistrationRequired && !registerClaimSuccessful) { - console.log('claim reg required but failed'); return true; } return false;