update and unit tests
This commit is contained in:
parent
f43ac712ff
commit
6cbb1f7201
2 changed files with 29 additions and 3 deletions
|
|
@ -219,6 +219,32 @@ describe('navigation', () => {
|
||||||
expect(wrapper.vm.mainStore.updatePolicyData).toHaveBeenCalled();
|
expect(wrapper.vm.mainStore.updatePolicyData).toHaveBeenCalled();
|
||||||
expect(wrapper.vm.mainStore.getCoveragePolicyInfo).toHaveBeenCalled();
|
expect(wrapper.vm.mainStore.getCoveragePolicyInfo).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
test('if isCoverageLookupEnabled is false, then getCoveragePolicyInfo not called', async () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = getMountedComponent({});
|
||||||
|
useMainStore().getDuplicateReferrals = jest.fn().mockImplementation(() => Promise.resolve({}));
|
||||||
|
useMainStore().applicationUser.coverageAttempts = 11;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.mainStore.updatePolicyData).toHaveBeenCalled();
|
||||||
|
expect(wrapper.vm.mainStore.getCoveragePolicyInfo).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
test('if isCoverageLookupEnabled is true, then getCoveragePolicyInfo called', async () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = getMountedComponent({});
|
||||||
|
useMainStore().getDuplicateReferrals = jest.fn().mockImplementation(() => Promise.resolve({}));
|
||||||
|
useMainStore().applicationUser.coverageAttempts = 10;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.mainStore.updatePolicyData).toHaveBeenCalled();
|
||||||
|
expect(wrapper.vm.mainStore.getCoveragePolicyInfo).toHaveBeenCalled();
|
||||||
|
});
|
||||||
test('if policy and vehicles are found but no duplicates, navigate to policy-vehicle page', async () => {
|
test('if policy and vehicles are found but no duplicates, navigate to policy-vehicle page', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
|
||||||
|
|
@ -309,8 +309,8 @@ export default {
|
||||||
isCoverageEnabled() {
|
isCoverageEnabled() {
|
||||||
return this.mainStore.issConfig.isCoverageEnabled;
|
return this.mainStore.issConfig.isCoverageEnabled;
|
||||||
},
|
},
|
||||||
isCoverageLookupRestricted() {
|
isCoverageLookupEnabled() {
|
||||||
return this.mainStore.applicationUser.coverageAttempts >= 10;
|
return this.mainStore.applicationUser.coverageAttempts <= 10;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -319,7 +319,7 @@ export default {
|
||||||
await this.mainStore.getDuplicateReferrals()
|
await this.mainStore.getDuplicateReferrals()
|
||||||
.then(() => {}, () => {})
|
.then(() => {}, () => {})
|
||||||
.finally(async () => {
|
.finally(async () => {
|
||||||
if (this.isCoverageEnabled && !this.isCoverageLookupRestricted) {
|
if (this.isCoverageEnabled && this.isCoverageLookupEnabled) {
|
||||||
await this.mainStore.getCoveragePolicyInfo()?.then(() => {}, () => {});
|
await this.mainStore.getCoveragePolicyInfo()?.then(() => {}, () => {});
|
||||||
} else {
|
} else {
|
||||||
this.mainStore.order.policy.policyLookupSuccessful = false;
|
this.mainStore.order.policy.policyLookupSuccessful = false;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue