Merge pull request #505 from Safelite/feature/SSR-862

fix to unverified flow
This commit is contained in:
katiekroell 2023-11-17 09:25:17 -05:00 committed by GitHub
commit d6249dfed4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 8 deletions

View file

@ -367,6 +367,37 @@ describe.skip('coverageStatement.vue', () => {
]
});
// Assert
expect(wrapper.vm.verifiedDeductible).toBeFalsy();
});
test('If deductible is null, verifiedDeductible returns false', () => {
const sellingPrice = getRandomInt(100, 500);
const deductible = null;
const mainInitialState = {
order: {
damage: {
isRepair: true
},
policy: {
noCoverage: false,
deductible: {
repair: deductible
}
}
}
};
const { wrapper } = getMountedComponent(mainInitialState);
wrapper.setData({
availableLineItems: [
{
sellingPrice,
kitPrice: 0,
laborAmount: 0
}
]
});
// Assert
expect(wrapper.vm.verifiedDeductible).toBeFalsy();
});
@ -747,7 +778,7 @@ describe.skip('coverageStatement.vue', () => {
expect(wrapper.vm.mainStore.registerClaim).not.toHaveBeenCalled();
});
it.only('claim registration required => register claim method called', async () => {
it('claim registration required => register claim method called', async () => {
// Arrange
const sellingPrice = getRandomInt(50, 100);
const deductible = sellingPrice - 1;

View file

@ -147,7 +147,6 @@ export default {
// Call APIs
const cmsContentPromise = fetchCmsContentForPage(to?.query?.issPage);
const supportingItemsPromise = await useMainStore().getSupportingItems();
const finalDeductiblePromise = await useMainStore().getFinalDeductible();
// Settle promises and get results
const promiseResultMap = [
@ -158,10 +157,6 @@ export default {
{
resultKey: 'supportingItems',
promise: supportingItemsPromise
},
{
resultKey: 'finalDeductible',
promise: finalDeductiblePromise
}
];
@ -174,7 +169,11 @@ export default {
...(clonedGlassParts ?? [])
];
const pricingResults = await useMainStore().getPriceOrderItems(availableLineItems);
let pricingResults = [];
if (useMainStore().order.policy.policyLookupSuccessful) {
pricingResults = await useMainStore().getPriceOrderItems(availableLineItems);
await useMainStore().getFinalDeductible();
}
// Call the "next" function to complete the transition to this page.
next((vm) => {
@ -280,7 +279,7 @@ export default {
},
verifiedDeductible() {
return useMainStore().isClaimRegistrationRequired
? this.registerClaimSuccessful && this.coveredAndServicePriceAboveOrEqualDeductible
? this.registerClaimSuccessful && this.coveredAndServicePriceAboveOrEqualDeductible && this.vehicleDeductible !== null
: this.policyLookupSuccessful && this.coveredAndServicePriceAboveOrEqualDeductible;
},
unverified() {