fixing tests

This commit is contained in:
brydon1 2023-09-06 13:13:20 -04:00
parent a91d4ad431
commit 50313df9fc
2 changed files with 39 additions and 9 deletions

View file

@ -9,6 +9,7 @@ import navigationScenarios from '@/router/router-constants/navigation-scenarios.
import { getRandomString, getRandomInt } from '@/helpers/data-generation.js';
import settleAllPromises from '@/helpers/layout-helper.js';
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
import routerParams from '@/router/router-constants/router-params';
jest.mock('@/helpers/layout-helper.js', () => jest.fn());
@ -457,7 +458,11 @@ describe('coverageStatement.vue', () => {
// Assert
expect(wrapper.vm.$router.navigate)
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD, undefined);
.toHaveBeenCalledWith(
navigationScenarios.CLICKED_FORWARD,
undefined,
{},
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true });
});
test('If Verified Deductible, navigate forward with CLICKED_FORWARD scenario', () => {
// Arrange
@ -493,7 +498,11 @@ describe('coverageStatement.vue', () => {
// Assert
expect(wrapper.vm.$router.navigate)
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD, undefined);
.toHaveBeenCalledWith(
navigationScenarios.CLICKED_FORWARD,
undefined,
{},
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true });
});
test('If Verified ITAC and selected Safelite, navigate forward with CLICKED_FORWARD_WITH_SAFELITE scenario', () => {
// Arrange
@ -530,7 +539,11 @@ describe('coverageStatement.vue', () => {
// Assert
expect(wrapper.vm.$router.navigate)
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE, undefined);
.toHaveBeenCalledWith(
navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE,
undefined,
{},
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true });
});
test('If Verified ITAC, selected other shop, and TPA enabled, navigate forward w/ CLICKED_FORWARD_WITH_TPA_ENABLED', () => {
// Arrange
@ -570,7 +583,11 @@ describe('coverageStatement.vue', () => {
// Assert
expect(wrapper.vm.$router.navigate)
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_TPA_ENABLED, undefined);
.toHaveBeenCalledWith(
navigationScenarios.CLICKED_FORWARD_WITH_TPA_ENABLED,
undefined,
{},
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true });
});
test('If Verified ITAC, selected other shop, and TPA disabled, navigate forward w/ CLICKED_FORWARD_WITH_TPA_DISABLED', () => {
// Arrange
@ -610,7 +627,11 @@ describe('coverageStatement.vue', () => {
// Assert
expect(wrapper.vm.$router.navigate)
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_TPA_DISABLED, undefined);
.toHaveBeenCalledWith(
navigationScenarios.CLICKED_FORWARD_WITH_TPA_DISABLED,
undefined,
{},
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true });
});
test('If No Comp and selected Safelite, navigate forward with CLICKED_FORWARD scenario', () => {
// Arrange
@ -636,7 +657,11 @@ describe('coverageStatement.vue', () => {
// Assert
expect(wrapper.vm.$router.navigate)
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE, undefined);
.toHaveBeenCalledWith(
navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE,
undefined,
{},
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true });
});
});
describe('ADAS', () => {

View file

@ -10,6 +10,7 @@ import { getMountOptions } from '@/helpers/unit-test-helper.js';
import applicationConfig from '@/constants/application-config';
import { useMainStore } from '@/store';
import navigationScenarios from '@/router/router-constants/navigation-scenarios';
import routerParams from '@/router/router-constants/router-params';
// Mock our module for promises.
jest.mock('@/helpers/layout-helper.js', () => jest.fn());
@ -182,7 +183,7 @@ describe('navigation', () => {
navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
undefined,
{},
{},
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true },
mockvehicles
);
});
@ -208,7 +209,9 @@ describe('navigation', () => {
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
undefined
undefined,
{},
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
);
});
test('if policy is not found, navigate to policy-holder-details page', async () => {
@ -228,7 +231,9 @@ describe('navigation', () => {
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
undefined
undefined,
{},
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
);
});
});