Adding tests confirming when store methods called
This commit is contained in:
parent
2f8f69e7ee
commit
eed2f6dd45
1 changed files with 26 additions and 0 deletions
|
|
@ -194,6 +194,32 @@ describe('navigation', () => {
|
|||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
||||
);
|
||||
});
|
||||
test('if isCoverageEnabled is false, then getCoveragePolicyInfo not called', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = getMountedComponent({});
|
||||
useMainStore().getDuplicateReferrals = jest.fn().mockImplementation(() => Promise.resolve({}));
|
||||
useMainStore().issConfig.isCoverageEnabled = false;
|
||||
|
||||
// Act
|
||||
await wrapper.vm.forwardButtonAction();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.mainStore.updatePolicyData).toHaveBeenCalled();
|
||||
expect(wrapper.vm.mainStore.getCoveragePolicyInfo).not.toHaveBeenCalled();
|
||||
});
|
||||
test('if isCoverageEnabled is true, then getCoveragePolicyInfo called', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = getMountedComponent({});
|
||||
useMainStore().getDuplicateReferrals = jest.fn().mockImplementation(() => Promise.resolve({}));
|
||||
useMainStore().issConfig.isCoverageEnabled = true;
|
||||
|
||||
// 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({});
|
||||
|
|
|
|||
Loading…
Reference in a new issue