mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-26 10:21:09 -04:00
Separate logout by user or inactivity
This commit is contained in:
@@ -72,16 +72,26 @@ describe('The session timer ', () => {
|
||||
jest.useFakeTimers();
|
||||
});
|
||||
|
||||
test('logoutUser method logs the user out', () => {
|
||||
const logoutUserMethod = window.GOVUK.Modules.TimeoutPopup.logoutUser;
|
||||
test('signoutUser method logs the user out', () => {
|
||||
const signoutUserMethod = window.GOVUK.Modules.TimeoutPopup.signoutUser;
|
||||
|
||||
expect(window.location.href).toEqual(expect.not.stringContaining('/sign-out'));
|
||||
|
||||
logoutUserMethod();
|
||||
signoutUserMethod();
|
||||
|
||||
expect(window.location.href).toEqual(expect.stringContaining('/sign-out'));
|
||||
});
|
||||
|
||||
test('expireUserSession method logs the user out with next query parameter', () => {
|
||||
const expireUserSessionMethod = window.GOVUK.Modules.TimeoutPopup.expireUserSession;
|
||||
|
||||
expect(window.location.href).toEqual(expect.not.stringContaining('/sign-out?next='));
|
||||
|
||||
expireUserSessionMethod();
|
||||
|
||||
expect(window.location.href).toEqual(expect.stringContaining('/sign-out?next='));
|
||||
});
|
||||
|
||||
test('extendSession method reloads the page', () => {
|
||||
const windowReload = jest.spyOn(window.location, 'reload');
|
||||
const extendSessionMethod = window.GOVUK.Modules.TimeoutPopup.extendSession;
|
||||
|
||||
Reference in New Issue
Block a user