Adding router test
This commit is contained in:
parent
8c59ba9c6e
commit
54310b95c4
2 changed files with 15 additions and 1 deletions
|
|
@ -195,7 +195,6 @@ router.navigateWithoutSaving = (
|
|||
optionalParams = {},
|
||||
optionalPageData = {}
|
||||
) => {
|
||||
// TODO does not save session
|
||||
navigate(scenario, currentRoute, optionalQuery, optionalParams, optionalPageData);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -21,4 +21,19 @@ describe('Router', () => {
|
|||
router.navigate(scenario, currentRoute);
|
||||
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