Fixing claim registration tests
This commit is contained in:
parent
c7de5b3713
commit
79cae6ddd9
2 changed files with 7 additions and 43 deletions
|
|
@ -704,32 +704,20 @@ describe('coverageStatement.vue', () => {
|
|||
expect(wrapper.vm.isADAS).toBeFalsy();
|
||||
});
|
||||
});
|
||||
describe.only('claim registration api call', () => {
|
||||
// TODO fix test to actually work
|
||||
describe('claim registration api call', () => {
|
||||
it('claim registration not required => method not called', async () => {
|
||||
// Arrange
|
||||
getMountedComponent({
|
||||
const { wrapper } = getMountedComponent({
|
||||
issConfig: {
|
||||
isClaimRegistrationRequired: false
|
||||
}
|
||||
});
|
||||
|
||||
const store = useMainStore();
|
||||
// store.isClaimRegistrationRequired = false;
|
||||
|
||||
// const to = {
|
||||
// query: { issPage: getRandomString(4, 10) }
|
||||
// };
|
||||
// const next = jest.fn();
|
||||
|
||||
// SUT
|
||||
// coverageStatement.beforeRouteEnter.call(wrapper.vm, to, undefined, next);
|
||||
|
||||
// Assert
|
||||
expect(store.registerClaim).not.toHaveBeenCalled();
|
||||
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;
|
||||
|
|
@ -759,35 +747,11 @@ describe('coverageStatement.vue', () => {
|
|||
}
|
||||
]
|
||||
};
|
||||
|
||||
const { wrapper } = getMountedComponent(initialStore, initialData);
|
||||
|
||||
// console.log(wrapper.vm.availableLineItems);
|
||||
// await wrapper.setData({
|
||||
// availableLineItems: [
|
||||
// {
|
||||
// sellingPrice,
|
||||
// kitPrice: 0,
|
||||
// laborAmount: 0
|
||||
// }
|
||||
// ]
|
||||
// });
|
||||
|
||||
// const store = useMainStore();
|
||||
// store.order.policy.policyLookupSuccessful = true;
|
||||
// store.isClaimRegistrationRequired = true;
|
||||
// store.order.policy.noCoverage = false;
|
||||
// store.order.damage.isRepair = true;
|
||||
// store.order.policy.deductible.repair = deductible;
|
||||
|
||||
// const to = {
|
||||
// query: { issPage: getRandomString(4, 10) }
|
||||
// };
|
||||
// const next = jest.fn();
|
||||
|
||||
// SUT
|
||||
// coverageStatement.beforeRouteEnter.call(wrapper.vm, to, undefined, next);
|
||||
// Assert
|
||||
// expect(store.registerClaim).toHaveBeenCalled();
|
||||
expect(wrapper.vm.mainStore.registerClaim).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ export default {
|
|||
if (this.policyLookupSuccessful
|
||||
&& useMainStore().isClaimRegistrationRequired
|
||||
&& this.coveredAndServicePriceAboveOrEqualDeductible) {
|
||||
await useMainStore().registerClaim().catch(() => {});
|
||||
await useMainStore().registerClaim()?.catch(() => {});
|
||||
}
|
||||
vm.$refs.loadingModal.hideModal();
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue