Adding tests confirming when store methods called

This commit is contained in:
Michaela Brydon 2023-10-11 14:22:13 -04:00
parent 2f8f69e7ee
commit eed2f6dd45

View file

@ -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({});