Merge pull request #784 from Safelite/defect/digital/SSR-1411
SSR-1411 rework save session to be awaitable
This commit is contained in:
commit
828864887d
13 changed files with 66 additions and 62 deletions
|
|
@ -34,15 +34,12 @@ export async function saveSession({ shouldAwaitSaveSessionQueue = false, submitA
|
||||||
Will determine if to submitWorkOrder.
|
Will determine if to submitWorkOrder.
|
||||||
TODO: Add more description to this
|
TODO: Add more description to this
|
||||||
*/
|
*/
|
||||||
export async function submitWorkOrder({
|
export async function submitWorkOrder({ submitType }) {
|
||||||
pageNameToLog,
|
const store = useMainStore();
|
||||||
submitAfterSave = false,
|
store.resetSubmittedOrder();
|
||||||
createDeleteStatusWorkOrderForPia = false
|
|
||||||
}) {
|
|
||||||
await saveSession({
|
await saveSession({
|
||||||
pageNameToLog,
|
|
||||||
shouldAwaitSaveSessionQueue: true,
|
shouldAwaitSaveSessionQueue: true,
|
||||||
submitAfterSave,
|
submitAfterSave: true
|
||||||
createDeleteStatusWorkOrderForPia
|
|
||||||
});
|
});
|
||||||
|
store.createSubmittedOrder(submitType);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -436,19 +436,19 @@ describe('Bailout page', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('forwardButtonAction', () => {
|
describe('forwardButtonAction', () => {
|
||||||
test('should navigate to the next route', () => {
|
test('should navigate to the next route', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = getMountedComponent();
|
const { wrapper } = getMountedComponent();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.forwardButtonAction();
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
|
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
|
||||||
wrapper.vm.navigationScenarios.CLICKED_FORWARD,
|
wrapper.vm.navigationScenarios.CLICKED_FORWARD,
|
||||||
wrapper.vm.$route,
|
wrapper.vm.$route,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ import canBailoutNavigateBack from '@/helpers/bailout-helper';
|
||||||
import BailoutCode from '@/constants/bailoutCode';
|
import BailoutCode from '@/constants/bailoutCode';
|
||||||
import issPageValues from '@/router/router-constants/issPage-values';
|
import issPageValues from '@/router/router-constants/issPage-values';
|
||||||
import MaskaFormattedMasks from '@/constants/maska-masks';
|
import MaskaFormattedMasks from '@/constants/maska-masks';
|
||||||
|
import { saveSession } from '@/helpers/order-helper';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'bailout-page',
|
name: 'bailout-page',
|
||||||
|
|
@ -200,13 +201,14 @@ export default {
|
||||||
this.$route
|
this.$route
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
this.mainStore.setBailoutContactInfo(this.bailoutPageModel);
|
this.mainStore.setBailoutContactInfo(this.bailoutPageModel);
|
||||||
|
await saveSession({ shouldAwaitSaveSessionQueue: true });
|
||||||
this.$router.navigate(
|
this.$router.navigate(
|
||||||
this.navigationScenarios.CLICKED_FORWARD,
|
this.navigationScenarios.CLICKED_FORWARD,
|
||||||
this.$route,
|
this.$route,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
getBailoutPageModelFromStore() {
|
getBailoutPageModelFromStore() {
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ export default {
|
||||||
this.unauthorized = !isAuthorized;
|
this.unauthorized = !isAuthorized;
|
||||||
|
|
||||||
if (isAuthorized) {
|
if (isAuthorized) {
|
||||||
await this.populateISSConfigValues(clientData);
|
this.populateISSConfigValues(clientData);
|
||||||
|
|
||||||
if (clientData.parameters?.length > 0) {
|
if (clientData.parameters?.length > 0) {
|
||||||
const finalParams = this.combineClientParameters(clientData.parameters, queryStringParams);
|
const finalParams = this.combineClientParameters(clientData.parameters, queryStringParams);
|
||||||
|
|
@ -100,7 +100,7 @@ export default {
|
||||||
|
|
||||||
return { isAuthorized: authorized, clientData };
|
return { isAuthorized: authorized, clientData };
|
||||||
},
|
},
|
||||||
async populateISSConfigValues(data) {
|
populateISSConfigValues(data) {
|
||||||
this.mainStore.issConfig.clientName = data.accountName;
|
this.mainStore.issConfig.clientName = data.accountName;
|
||||||
this.mainStore.issConfig.clientDisplayName = data.accountName; // Defaults to use the client name.
|
this.mainStore.issConfig.clientDisplayName = data.accountName; // Defaults to use the client name.
|
||||||
this.mainStore.issConfig.parentAccountNumber = data.parentAccountNumber;
|
this.mainStore.issConfig.parentAccountNumber = data.parentAccountNumber;
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,6 @@ export default {
|
||||||
},
|
},
|
||||||
mixins: [BaseFormMixin],
|
mixins: [BaseFormMixin],
|
||||||
async beforeRouteEnter(to, from, next) {
|
async beforeRouteEnter(to, from, next) {
|
||||||
useMainStore().createSubmittedOrder(submitType.SAFELITE);
|
|
||||||
// Call APIs
|
// Call APIs
|
||||||
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ import { AppointmentTypeStrings } from '@/constants/schedule-constants';
|
||||||
import VehicleBanner from '@/iss-components/vehicle-banner/vehicle-banner.vue';
|
import VehicleBanner from '@/iss-components/vehicle-banner/vehicle-banner.vue';
|
||||||
import { submitWorkOrder } from '@/helpers/order-helper.js';
|
import { submitWorkOrder } from '@/helpers/order-helper.js';
|
||||||
import { experimentSettings } from '@/constants/experiments';
|
import { experimentSettings } from '@/constants/experiments';
|
||||||
|
import submitType from '@/constants/submit-type';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'payment-method',
|
name: 'payment-method',
|
||||||
|
|
@ -300,12 +301,7 @@ export default {
|
||||||
|
|
||||||
if (this.paymentMethod === paymentMethods.PAY_AT_TIME_OF_SERVICE) {
|
if (this.paymentMethod === paymentMethods.PAY_AT_TIME_OF_SERVICE) {
|
||||||
try {
|
try {
|
||||||
await submitWorkOrder({
|
await submitWorkOrder({ submitType: submitType.SAFELITE }).then(() => {
|
||||||
pageNameToLog: 'payment-method',
|
|
||||||
submitAfterSave: true
|
|
||||||
}).then(() => {
|
|
||||||
useMainStore().resetSubmittedOrder();
|
|
||||||
|
|
||||||
this.$router.navigate(
|
this.$router.navigate(
|
||||||
this.navigationScenarios.CLICKED_FORWARD,
|
this.navigationScenarios.CLICKED_FORWARD,
|
||||||
this.$route
|
this.$route
|
||||||
|
|
|
||||||
|
|
@ -124,12 +124,8 @@ export default {
|
||||||
},
|
},
|
||||||
async saveAndSubmitWorkOrder() {
|
async saveAndSubmitWorkOrder() {
|
||||||
// Final work order submit after returning from pay in advance.
|
// Final work order submit after returning from pay in advance.
|
||||||
useMainStore().resetSubmittedOrder();
|
|
||||||
try {
|
try {
|
||||||
await submitWorkOrder({
|
await submitWorkOrder({ submitType: submitType.SAFELITE });
|
||||||
pageNameToLog: 'payment-return',
|
|
||||||
submitAfterSave: true
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`error: response from submit work order:${error.message}`);
|
console.error(`error: response from submit work order:${error.message}`);
|
||||||
this.navigateOnPayInAdvanceError();
|
this.navigateOnPayInAdvanceError();
|
||||||
|
|
@ -138,7 +134,6 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
showIssLoadingModal(false);
|
showIssLoadingModal(false);
|
||||||
useMainStore().createSubmittedOrder(submitType.SAFELITE);
|
|
||||||
this.$router.navigate(
|
this.$router.navigate(
|
||||||
this.navigationScenarios.PAY_IN_ADVANCE_SUCCESS,
|
this.navigationScenarios.PAY_IN_ADVANCE_SUCCESS,
|
||||||
this.$route
|
this.$route
|
||||||
|
|
|
||||||
|
|
@ -354,11 +354,7 @@ export default {
|
||||||
},
|
},
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
try {
|
try {
|
||||||
await submitWorkOrder({
|
await submitWorkOrder({ submitType: submitType.TPA }).then(() => {
|
||||||
pageNameToLog: 'tpa-submit',
|
|
||||||
submitAfterSave: true
|
|
||||||
}).then(() => {
|
|
||||||
useMainStore().createSubmittedOrder(submitType.TPA);
|
|
||||||
this.navigate(this.navigationScenarios.CLICKED_FORWARD);
|
this.navigate(this.navigationScenarios.CLICKED_FORWARD);
|
||||||
}).catch((submitError) => {
|
}).catch((submitError) => {
|
||||||
useMainStore().setBailout(bailoutMessage.saveSessionError(submitError.data));
|
useMainStore().setBailout(bailoutMessage.saveSessionError(submitError.data));
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,6 @@ describe('navigation', () => {
|
||||||
await wrapper.vm.forwardButtonAction();
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.mainStore.getDuplicateReferrals).toHaveBeenCalledTimes(0);
|
|
||||||
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(0);
|
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -206,7 +205,7 @@ describe('navigation', () => {
|
||||||
navigationScenarios.CLICKED_FORWARD_WITH_DUPLICATES,
|
navigationScenarios.CLICKED_FORWARD_WITH_DUPLICATES,
|
||||||
undefined,
|
undefined,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
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 () => {
|
||||||
|
|
@ -234,7 +233,7 @@ describe('navigation', () => {
|
||||||
navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
|
navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
|
||||||
undefined,
|
undefined,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
test('if policy is found, but no vehicles and no duplicates, navigate to vehicle-selection page', async () => {
|
test('if policy is found, but no vehicles and no duplicates, navigate to vehicle-selection page', async () => {
|
||||||
|
|
@ -259,7 +258,7 @@ describe('navigation', () => {
|
||||||
navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
|
navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
|
||||||
undefined,
|
undefined,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
test('if policy is found, but null vehicles and no duplicates, navigate to vehicle-selection page', async () => {
|
test('if policy is found, but null vehicles and no duplicates, navigate to vehicle-selection page', async () => {
|
||||||
|
|
@ -285,7 +284,7 @@ describe('navigation', () => {
|
||||||
navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
|
navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
|
||||||
undefined,
|
undefined,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
test('if policy is not found and no duplicates, navigate to policy-holder-details page', async () => {
|
test('if policy is not found and no duplicates, navigate to policy-holder-details page', async () => {
|
||||||
|
|
@ -310,7 +309,7 @@ describe('navigation', () => {
|
||||||
navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
|
navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
|
||||||
undefined,
|
undefined,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
test('getDuplicateReferrals throws rejected promise => navigate called', async () => {
|
test('getDuplicateReferrals throws rejected promise => navigate called', async () => {
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,8 @@ import states from '@/constants/states';
|
||||||
import globalRules from '@/constants/global-rules';
|
import globalRules from '@/constants/global-rules';
|
||||||
import routerParams from '@/router/router-constants/router-params';
|
import routerParams from '@/router/router-constants/router-params';
|
||||||
import MaskaFormattedMasks from '@/constants/maska-masks';
|
import MaskaFormattedMasks from '@/constants/maska-masks';
|
||||||
|
import { saveSession } from '@/helpers/order-helper';
|
||||||
|
import bailoutMessage from '@/constants/bailoutMessage';
|
||||||
|
|
||||||
// define validation rules
|
// define validation rules
|
||||||
defineRule(
|
defineRule(
|
||||||
|
|
@ -299,17 +301,22 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
try {
|
try {
|
||||||
await this.configureZip();
|
|
||||||
this.mainStore.updatePolicyData(this.welcomePageModel);
|
this.mainStore.updatePolicyData(this.welcomePageModel);
|
||||||
await this.mainStore.getBillToInfo();
|
await Promise.allSettled([
|
||||||
await this.mainStore.getDuplicateReferrals();
|
this.configureZip().then(async () => await this.mainStore.getBillToInfo()),
|
||||||
await this.mainStore.getCoveragePolicyInfo();
|
this.mainStore.getDuplicateReferrals(),
|
||||||
|
this.mainStore.getCoveragePolicyInfo()
|
||||||
|
]);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
// TODO: Bailout?
|
// TODO: Bailout?
|
||||||
} finally {
|
} finally {
|
||||||
if (!this.displayInvalidZipAlert) {
|
if (!this.displayInvalidZipAlert) {
|
||||||
this.navigateForward();
|
await saveSession({ shouldAwaitSaveSessionQueue: true })
|
||||||
|
.catch((error) => {
|
||||||
|
this.mainStore.setBailout(bailoutMessage.saveSessionError(error.data));
|
||||||
|
})
|
||||||
|
.finally(() => this.navigateForward());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -324,12 +331,19 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
navigateForward() {
|
navigateForward() {
|
||||||
if (this.mainStore.applicationUser.duplicateOrders?.length > 0 ?? false) {
|
if (this.mainStore.isBailout) {
|
||||||
|
this.$router.navigate(
|
||||||
|
this.navigationScenarios.SAVE_SESSION_FAILED,
|
||||||
|
this.$route,
|
||||||
|
{},
|
||||||
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
|
);
|
||||||
|
} else if (this.mainStore.applicationUser.duplicateOrders?.length > 0 ?? false) {
|
||||||
this.$router.navigate(
|
this.$router.navigate(
|
||||||
this.navigationScenarios.CLICKED_FORWARD_WITH_DUPLICATES,
|
this.navigationScenarios.CLICKED_FORWARD_WITH_DUPLICATES,
|
||||||
this.$route,
|
this.$route,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
} else if (this.mainStore.isPolicyLookupSuccessful) {
|
} else if (this.mainStore.isPolicyLookupSuccessful) {
|
||||||
if (this.mainStore.order.policy.vehicles?.length > 0 ?? false) {
|
if (this.mainStore.order.policy.vehicles?.length > 0 ?? false) {
|
||||||
|
|
@ -339,7 +353,7 @@ export default {
|
||||||
.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
|
.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
|
||||||
this.$route,
|
this.$route,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// navigate to vehicle-selection page (manual entry)
|
// navigate to vehicle-selection page (manual entry)
|
||||||
|
|
@ -348,7 +362,7 @@ export default {
|
||||||
.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
|
.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
|
||||||
this.$route,
|
this.$route,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -357,7 +371,7 @@ export default {
|
||||||
this.navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
|
this.navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
|
||||||
this.$route,
|
this.$route,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -171,17 +171,9 @@ router.afterEach(async (to, from) => {
|
||||||
store.clearSaveSessionPromise();
|
store.clearSaveSessionPromise();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (to.query.issPage !== issPageValues.TPA_CONFIRMATION && to.query.issPage !== issPageValues.ORDER_CONFIRMATION) {
|
const skipSaveSession = !!router.options.history.state[routerParams.SKIP_SAVE_SESSION];
|
||||||
const saveSessionSynchronous = !!router.options.history.state[routerParams.SAVE_SESSION_SYNCHRONOUS];
|
if (!skipSaveSession && !store.hasSubmittedOrder()) {
|
||||||
await saveSession({ shouldAwaitSaveSessionQueue: saveSessionSynchronous }).catch((error) => {
|
await saveSession({});
|
||||||
if (from.name === issPageValues.WELCOME_PAGE) {
|
|
||||||
store.setBailout(bailoutMessage.saveSessionError(error.data));
|
|
||||||
router.navigate(
|
|
||||||
navigationScenarios.SAVE_SESSION_FAILED,
|
|
||||||
{ query: { issPage: issPageValues.WELCOME_PAGE } }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (to.query.issPage !== issPageValues.ENTRY_PAGE) {
|
if (to.query.issPage !== issPageValues.ENTRY_PAGE) {
|
||||||
|
|
@ -203,7 +195,6 @@ router.navigateWithoutSaving = (
|
||||||
optionalParams = {},
|
optionalParams = {},
|
||||||
optionalPageData = {}
|
optionalPageData = {}
|
||||||
) => {
|
) => {
|
||||||
// TODO does not save session
|
|
||||||
navigate(scenario, currentRoute, optionalQuery, optionalParams, optionalPageData);
|
navigate(scenario, currentRoute, optionalQuery, optionalParams, optionalPageData);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
const routerParams = Object.freeze({
|
const routerParams = Object.freeze({
|
||||||
DISPLAY_VEHICLE_CHANGE_ALERT: 'displayVehicleChangeAlert',
|
DISPLAY_VEHICLE_CHANGE_ALERT: 'displayVehicleChangeAlert',
|
||||||
SAVE_SESSION_SYNCHRONOUS: 'saveSessionSynchronous'
|
SKIP_SAVE_SESSION: 'skipSaveSession'
|
||||||
});
|
});
|
||||||
|
|
||||||
export default routerParams;
|
export default routerParams;
|
||||||
|
|
|
||||||
|
|
@ -21,4 +21,19 @@ describe('Router', () => {
|
||||||
router.navigate(scenario, currentRoute);
|
router.navigate(scenario, currentRoute);
|
||||||
expect(router.push.mock.calls[0][0].query.issPage).toBe(issPageValues.POLICY_HOLDER_DETAILS);
|
expect(router.push.mock.calls[0][0].query.issPage).toBe(issPageValues.POLICY_HOLDER_DETAILS);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Should set state as expected', () => {
|
||||||
|
// Arrange
|
||||||
|
const scenario = navigationScenarios.CLICKED_FORWARD;
|
||||||
|
const currentRoute = { query: { issPage: issPageValues.WELCOME_PAGE } };
|
||||||
|
const parameters = {saveSync: true};
|
||||||
|
|
||||||
|
router.push = jest.fn();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
router.navigate(scenario, currentRoute, {}, parameters);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(router.push.mock.calls[0][0].state).toBe(parameters);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue