21720: changed runTimersToTime to advanceTimersByTime
[arvados.git] / services / workbench2 / src / views-components / auto-logout / auto-logout.test.tsx
index 28084ed1c15e6c2af148ad0052c1cfe2b62ba3c1..b07e3dccfa059202b3305d7232973dcce9504cb0 100644 (file)
@@ -31,28 +31,28 @@ describe('<AutoLogoutComponent />', () => {
     });
 
     it('should logout after idle timeout', () => {
-        jest.runTimersToTime((sessionIdleTimeout-1)*1000);
+        jest.advanceTimersByTime((sessionIdleTimeout-1)*1000);
         expect(props.doLogout).not.toBeCalled();
-        jest.runTimersToTime(1*1000);
+        jest.advanceTimersByTime(1*1000);
         expect(props.doLogout).toBeCalled();
     });
 
     it('should warn the user previous to close the session', () => {
-        jest.runTimersToTime((sessionIdleTimeout-lastWarningDuration-1)*1000);
+        jest.advanceTimersByTime((sessionIdleTimeout-lastWarningDuration-1)*1000);
         expect(props.doWarn).not.toBeCalled();
-        jest.runTimersToTime(1*1000);
+        jest.advanceTimersByTime(1*1000);
         expect(props.doWarn).toBeCalled();
     });
 
     it('should reset the idle timer when activity event is received', () => {
-        jest.runTimersToTime((sessionIdleTimeout-lastWarningDuration-1)*1000);
+        jest.advanceTimersByTime((sessionIdleTimeout-lastWarningDuration-1)*1000);
         expect(props.doWarn).not.toBeCalled();
         // Simulate activity from other window/tab
         eventListeners.storage({
             key: LAST_ACTIVE_TIMESTAMP,
             newValue: '42' // value currently doesn't matter
         })
-        jest.runTimersToTime(1*1000);
+        jest.advanceTimersByTime(1*1000);
         // Warning should not appear because idle timer was reset
         expect(props.doWarn).not.toBeCalled();
     });