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 = {
|
const storeData = {
|
||||||
order: {
|
order: {
|
||||||
payment: {
|
payment: {
|
||||||
insuranceCoverage: {
|
insuranceCoverage: { isVerified: true }
|
||||||
coverageStatus: coverageStatuses.PENDING
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
policy: {
|
policy: {
|
||||||
isITAC: false
|
isITAC: false
|
||||||
|
|
@ -147,14 +145,18 @@ describe('cart-dropdown component', () => {
|
||||||
const initialData = { isExpanded };
|
const initialData = { isExpanded };
|
||||||
const storeData = {
|
const storeData = {
|
||||||
order: {
|
order: {
|
||||||
|
currentDeductible: 0,
|
||||||
|
lineItems: { },
|
||||||
payment: {
|
payment: {
|
||||||
insuranceCoverage: {
|
insuranceCoverage: { isVerified: true }
|
||||||
coverageStatus: coverageStatuses.PENDING
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
policy: {
|
policy: {
|
||||||
isITAC: true
|
isITAC: true,
|
||||||
|
policyLookupSuccessful: true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
issConfig: {
|
||||||
|
isClaimRegistrationRequired: true
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const { wrapper } = getMountedComponent(storeData, {}, initialData);
|
const { wrapper } = getMountedComponent(storeData, {}, initialData);
|
||||||
|
|
@ -296,14 +298,18 @@ describe('cart-dropdown component', () => {
|
||||||
const initialData = { isExpanded };
|
const initialData = { isExpanded };
|
||||||
const storeData = {
|
const storeData = {
|
||||||
order: {
|
order: {
|
||||||
|
currentDeductible: 0,
|
||||||
|
lineItems: { },
|
||||||
payment: {
|
payment: {
|
||||||
insuranceCoverage: {
|
insuranceCoverage: { isVerified: true }
|
||||||
coverageStatus: coverageStatuses.PENDING
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
policy: {
|
policy: {
|
||||||
isITAC: true
|
isITAC: true,
|
||||||
|
policyLookupSuccessful: true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
issConfig: {
|
||||||
|
isClaimRegistrationRequired: true
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const { wrapper } = getMountedComponent(storeData, {}, initialData);
|
const { wrapper } = getMountedComponent(storeData, {}, initialData);
|
||||||
|
|
@ -322,9 +328,7 @@ describe('cart-dropdown component', () => {
|
||||||
const storeData = {
|
const storeData = {
|
||||||
order: {
|
order: {
|
||||||
payment: {
|
payment: {
|
||||||
insuranceCoverage: {
|
insuranceCoverage: { isVerified: true }
|
||||||
coverageStatus: coverageStatuses.PENDING
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
policy: {
|
policy: {
|
||||||
isITAC: false
|
isITAC: false
|
||||||
|
|
@ -636,7 +640,9 @@ describe('cart-dropdown component', () => {
|
||||||
const storeData = {
|
const storeData = {
|
||||||
order: {
|
order: {
|
||||||
policy: {
|
policy: {
|
||||||
policyLookupSuccessful: true
|
policyLookupSuccessful: true,
|
||||||
|
noCoverage: false,
|
||||||
|
isITAC: false
|
||||||
},
|
},
|
||||||
currentDeductible: 250,
|
currentDeductible: 250,
|
||||||
lineItems: {
|
lineItems: {
|
||||||
|
|
@ -652,13 +658,7 @@ describe('cart-dropdown component', () => {
|
||||||
vaps: null
|
vaps: null
|
||||||
},
|
},
|
||||||
payment: {
|
payment: {
|
||||||
insuranceCoverage: {
|
insuranceCoverage: { isVerified: true }
|
||||||
coverageStatus: coverageStatuses.VERIFIED
|
|
||||||
}
|
|
||||||
},
|
|
||||||
policy: {
|
|
||||||
noCoverage: false,
|
|
||||||
isITAC: false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
issConfig: {
|
issConfig: {
|
||||||
|
|
@ -696,9 +696,7 @@ describe('cart-dropdown component', () => {
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
payment: {
|
payment: {
|
||||||
insuranceCoverage: {
|
insuranceCoverage: { isVerified: true }
|
||||||
coverageStatus: coverageStatuses.VERIFIED
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
issConfig: {
|
issConfig: {
|
||||||
|
|
@ -1761,12 +1759,12 @@ describe('cart-dropdown component', () => {
|
||||||
const storeData = {
|
const storeData = {
|
||||||
order: {
|
order: {
|
||||||
payment: {
|
payment: {
|
||||||
insuranceCoverage: {
|
insuranceCoverage: { isVerified: true }
|
||||||
coverageStatus: coverageStatuses.PENDING
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
policy: {
|
policy: {
|
||||||
isITAC: true
|
isITAC: true,
|
||||||
|
noCoverage: false,
|
||||||
|
policyLookupSuccessful: true
|
||||||
},
|
},
|
||||||
currentDeductible: 321
|
currentDeductible: 321
|
||||||
}
|
}
|
||||||
|
|
@ -1782,15 +1780,22 @@ describe('cart-dropdown component', () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(result).toBe(dollarAmount);
|
expect(result).toBe(dollarAmount);
|
||||||
});
|
});
|
||||||
test('returns dollar amount when no comp', () => {
|
test('returns dollar amount when no comp and enableNoCompQuotes true', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const storeData = {
|
const storeData = {
|
||||||
order: {
|
order: {
|
||||||
|
payment: {
|
||||||
|
insuranceCoverage: { isVerified: true }
|
||||||
|
},
|
||||||
policy: {
|
policy: {
|
||||||
isITAC: false,
|
isITAC: false,
|
||||||
noCoverage: true
|
noCoverage: true,
|
||||||
|
policyLookupSuccessful: true
|
||||||
},
|
},
|
||||||
currentDeductible: 321
|
currentDeductible: 321
|
||||||
|
},
|
||||||
|
issConfig: {
|
||||||
|
enableNoCompQuote: true
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const { wrapper } = getMountedComponent(storeData);
|
const { wrapper } = getMountedComponent(storeData);
|
||||||
|
|
@ -1804,21 +1809,46 @@ describe('cart-dropdown component', () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(result).toBe(dollarAmount);
|
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', () => {
|
test('returns dollar amount when deductible set, not itac, not no comp, and verified', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const storeData = {
|
const storeData = {
|
||||||
order: {
|
order: {
|
||||||
policy: {
|
policy: {
|
||||||
isITAC: false,
|
isITAC: false,
|
||||||
isNoComp: false,
|
noCoverage: false,
|
||||||
policyLookupSuccessful: true
|
policyLookupSuccessful: true
|
||||||
},
|
},
|
||||||
currentDeductible: 321,
|
currentDeductible: 321,
|
||||||
policyLookupSuccessful: true,
|
policyLookupSuccessful: true,
|
||||||
payment: {
|
payment: {
|
||||||
insuranceCoverage: {
|
insuranceCoverage: { isVerified: true }
|
||||||
coverageStatus: coverageStatuses.VERIFIED
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,8 @@ export default {
|
||||||
return this.submittedOrder ? this.submittedOrder.currentDeductible : useMainStore().order.currentDeductible;
|
return this.submittedOrder ? this.submittedOrder.currentDeductible : useMainStore().order.currentDeductible;
|
||||||
},
|
},
|
||||||
showDeductibleCartItem() {
|
showDeductibleCartItem() {
|
||||||
return !this.isNoComp && !this.isITAC;
|
const { isUnverified } = useMainStore();
|
||||||
|
return isUnverified || (!this.isNoComp && !this.isITAC);
|
||||||
},
|
},
|
||||||
lineItems() {
|
lineItems() {
|
||||||
return this.submittedOrder ? this.submittedOrder.lineItems : useMainStore().lineItems;
|
return this.submittedOrder ? this.submittedOrder.lineItems : useMainStore().lineItems;
|
||||||
|
|
@ -232,19 +233,13 @@ export default {
|
||||||
baseServicePrice() {
|
baseServicePrice() {
|
||||||
return getPriceOfLineItems(this.baseServiceLineItems) ?? 0;
|
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() {
|
isITAC() {
|
||||||
return this.submittedOrder ? this.submittedOrder.policy.isITAC : useMainStore().isITAC;
|
return this.submittedOrder ? this.submittedOrder.policy.isITAC : useMainStore().isITAC;
|
||||||
},
|
},
|
||||||
isNoComp() {
|
isNoComp() {
|
||||||
return this.submittedOrder ? this.submittedOrder.policy.noCoverage : useMainStore().isNoComp;
|
return this.submittedOrder ? this.submittedOrder.policy.noCoverage : useMainStore().isNoComp;
|
||||||
},
|
},
|
||||||
|
// TODO fix rounding
|
||||||
subTotal() {
|
subTotal() {
|
||||||
const { supportingItems, glassParts, otherParts, vaps, mobileFee } = this.lineItems;
|
const { supportingItems, glassParts, otherParts, vaps, mobileFee } = this.lineItems;
|
||||||
const allLineItems = [
|
const allLineItems = [
|
||||||
|
|
@ -270,13 +265,14 @@ export default {
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
salesTax() {
|
salesTax() {
|
||||||
|
const { isUnverified } = useMainStore();
|
||||||
function sumTax(lineItems) {
|
function sumTax(lineItems) {
|
||||||
return lineItems?.reduce((accumulator, lineItem) => accumulator + (lineItem.salesTax ?? 0), 0) ?? 0;
|
return lineItems?.reduce((accumulator, lineItem) => accumulator + (lineItem.salesTax ?? 0), 0) ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
let result = 0;
|
let result = 0;
|
||||||
|
|
||||||
if (!this.isUnverified) {
|
if (!isUnverified) {
|
||||||
if (this.isITAC || this.isNoComp) {
|
if (this.isITAC || this.isNoComp) {
|
||||||
result += sumTax(this.baseServiceLineItems);
|
result += sumTax(this.baseServiceLineItems);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -451,9 +447,8 @@ export default {
|
||||||
this.isExpanded = !this.isExpanded;
|
this.isExpanded = !this.isExpanded;
|
||||||
},
|
},
|
||||||
getDisplayed(amount) {
|
getDisplayed(amount) {
|
||||||
return this.isUnverified
|
const { isUnverified } = useMainStore();
|
||||||
&& !this.isNoComp
|
return isUnverified
|
||||||
&& !this.isITAC
|
|
||||||
? VERIFYING_COVERAGE
|
? VERIFYING_COVERAGE
|
||||||
: formatAmountInDollars(amount);
|
: formatAmountInDollars(amount);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -774,8 +774,7 @@ describe('coverageStatement.vue-working', () => {
|
||||||
order: {
|
order: {
|
||||||
payment: {
|
payment: {
|
||||||
insuranceCoverage: {
|
insuranceCoverage: {
|
||||||
claimNumber: null,
|
claimNumber: null
|
||||||
isVerified: true // Added
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
policy: {
|
policy: {
|
||||||
|
|
@ -854,19 +853,6 @@ describe('coverageStatement.vue-working', () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(result).toBeFalsy();
|
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', () => {
|
describe('returns true when policy lookup success, vehicleId set to %p, claim reg req, claim not yet reg', () => {
|
||||||
test('and itac', () => {
|
test('and itac', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
|
||||||
|
|
@ -381,7 +381,6 @@ export default {
|
||||||
&& policyVehicleId >= 0
|
&& policyVehicleId >= 0
|
||||||
&& isClaimRegistrationRequired
|
&& isClaimRegistrationRequired
|
||||||
&& !isClaimAlreadyRegistered
|
&& !isClaimAlreadyRegistered
|
||||||
&& !this.isNoCompQuoteVisible
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue