Merge pull request #642 from Safelite/bug/no-comp-should-unverified
Bug/no comp should unverified
This commit is contained in:
commit
eb983efdf9
4 changed files with 73 additions and 63 deletions
|
|
@ -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 }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -381,7 +381,6 @@ export default {
|
|||
&& policyVehicleId >= 0
|
||||
&& isClaimRegistrationRequired
|
||||
&& !isClaimAlreadyRegistered
|
||||
&& !this.isNoCompQuoteVisible
|
||||
);
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue