Adding router test

This commit is contained in:
Michaela Brydon 2024-07-11 13:17:08 -04:00
parent 8c59ba9c6e
commit 54310b95c4
2 changed files with 15 additions and 1 deletions

View file

@ -195,7 +195,6 @@ router.navigateWithoutSaving = (
optionalParams = {},
optionalPageData = {}
) => {
// TODO does not save session
navigate(scenario, currentRoute, optionalQuery, optionalParams, optionalPageData);
};

View file

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