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.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 () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
|
|
|
|||
|
|
@ -309,8 +309,8 @@ export default {
|
|||
isCoverageEnabled() {
|
||||
return this.mainStore.issConfig.isCoverageEnabled;
|
||||
},
|
||||
isCoverageLookupRestricted() {
|
||||
return this.mainStore.applicationUser.coverageAttempts >= 10;
|
||||
isCoverageLookupEnabled() {
|
||||
return this.mainStore.applicationUser.coverageAttempts <= 10;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -319,7 +319,7 @@ export default {
|
|||
await this.mainStore.getDuplicateReferrals()
|
||||
.then(() => {}, () => {})
|
||||
.finally(async () => {
|
||||
if (this.isCoverageEnabled && !this.isCoverageLookupRestricted) {
|
||||
if (this.isCoverageEnabled && this.isCoverageLookupEnabled) {
|
||||
await this.mainStore.getCoveragePolicyInfo()?.then(() => {}, () => {});
|
||||
} else {
|
||||
this.mainStore.order.policy.policyLookupSuccessful = false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue