File tree 2 files changed +41
-83
lines changed
app/javascript/components/session-timeout-dialog
2 files changed +41
-83
lines changed Original file line number Diff line number Diff line change
1
+ import { fromJS } from "immutable" ;
2
+ import sinon from "sinon" ;
3
+ import { createMocks } from "react-idle-timer" ;
4
+
5
+ import { mountedComponent , screen } from "../../test-utils" ;
6
+
7
+ import SessionTimeoutDialog from "./component" ;
8
+
9
+ describe ( "<SessionTimeoutDialog />" , ( ) => {
10
+ let component ;
11
+ let clock ;
12
+
13
+ clock = sinon . useFakeTimers ( ) ;
14
+ createMocks ( ) ;
15
+ it ( "should idle after 15 minutes" , ( ) => {
16
+ mountedComponent ( < SessionTimeoutDialog /> , fromJS ( {
17
+ application : {
18
+ userIdle : false
19
+ }
20
+ } ) )
21
+
22
+ expect ( screen . queryByRole ( 'dialog' ) ) . toBeNull ( )
23
+
24
+ } ) ;
25
+
26
+ describe ( "when user is offline" , ( ) => {
27
+ it ( "should not idle after 15 minutes" , ( ) => {
28
+ mountedComponent ( < SessionTimeoutDialog /> , fromJS ( {
29
+ application : {
30
+ userIdle : false
31
+ } ,
32
+ connectivity : {
33
+ online : false
34
+ }
35
+ } ) )
36
+
37
+ expect ( screen . queryByRole ( 'dialog' ) ) . toBeNull ( )
38
+
39
+ } ) ;
40
+ } ) ;
41
+ } ) ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments