55 DEFAULT_FLUSH_MIN_DELAY ,
66 MAX_SESSION_LIFE ,
77 REPLAY_SESSION_KEY ,
8- VISIBILITY_CHANGE_TIMEOUT ,
8+ SESSION_IDLE_DURATION ,
99 WINDOW ,
1010} from '../../src/constants' ;
1111import type { ReplayContainer } from '../../src/replay' ;
@@ -55,7 +55,7 @@ describe('Integration | session', () => {
5555 } ) ;
5656 } ) ;
5757
58- it ( 'creates a new session and triggers a full dom snapshot when document becomes visible after [VISIBILITY_CHANGE_TIMEOUT ]ms' , ( ) => {
58+ it ( 'creates a new session and triggers a full dom snapshot when document becomes visible after [SESSION_IDLE_DURATION ]ms' , ( ) => {
5959 Object . defineProperty ( document , 'visibilityState' , {
6060 configurable : true ,
6161 get : function ( ) {
@@ -65,7 +65,7 @@ describe('Integration | session', () => {
6565
6666 const initialSession = replay . session ;
6767
68- jest . advanceTimersByTime ( VISIBILITY_CHANGE_TIMEOUT + 1 ) ;
68+ jest . advanceTimersByTime ( SESSION_IDLE_DURATION + 1 ) ;
6969
7070 document . dispatchEvent ( new Event ( 'visibilitychange' ) ) ;
7171
@@ -75,7 +75,7 @@ describe('Integration | session', () => {
7575 expect ( replay ) . not . toHaveSameSession ( initialSession ) ;
7676 } ) ;
7777
78- it ( 'does not create a new session if user hides the tab and comes back within [VISIBILITY_CHANGE_TIMEOUT ] seconds' , ( ) => {
78+ it ( 'does not create a new session if user hides the tab and comes back within [SESSION_IDLE_DURATION ] seconds' , ( ) => {
7979 const initialSession = replay . session ;
8080
8181 Object . defineProperty ( document , 'visibilityState' , {
@@ -88,8 +88,8 @@ describe('Integration | session', () => {
8888 expect ( mockRecord . takeFullSnapshot ) . not . toHaveBeenCalled ( ) ;
8989 expect ( replay ) . toHaveSameSession ( initialSession ) ;
9090
91- // User comes back before `VISIBILITY_CHANGE_TIMEOUT ` elapses
92- jest . advanceTimersByTime ( VISIBILITY_CHANGE_TIMEOUT - 1 ) ;
91+ // User comes back before `SESSION_IDLE_DURATION ` elapses
92+ jest . advanceTimersByTime ( SESSION_IDLE_DURATION - 1 ) ;
9393 Object . defineProperty ( document , 'visibilityState' , {
9494 configurable : true ,
9595 get : function ( ) {
@@ -184,7 +184,7 @@ describe('Integration | session', () => {
184184 expect ( replay . session ) . toBe ( undefined ) ;
185185 } ) ;
186186
187- it ( 'creates a new session and triggers a full dom snapshot when document becomes visible after [VISIBILITY_CHANGE_TIMEOUT ]ms' , ( ) => {
187+ it ( 'creates a new session and triggers a full dom snapshot when document becomes visible after [SESSION_IDLE_DURATION ]ms' , ( ) => {
188188 Object . defineProperty ( document , 'visibilityState' , {
189189 configurable : true ,
190190 get : function ( ) {
@@ -194,7 +194,7 @@ describe('Integration | session', () => {
194194
195195 const initialSession = replay . session ;
196196
197- jest . advanceTimersByTime ( VISIBILITY_CHANGE_TIMEOUT + 1 ) ;
197+ jest . advanceTimersByTime ( SESSION_IDLE_DURATION + 1 ) ;
198198
199199 document . dispatchEvent ( new Event ( 'visibilitychange' ) ) ;
200200
@@ -204,7 +204,7 @@ describe('Integration | session', () => {
204204 expect ( replay ) . not . toHaveSameSession ( initialSession ) ;
205205 } ) ;
206206
207- it ( 'creates a new session and triggers a full dom snapshot when document becomes focused after [VISIBILITY_CHANGE_TIMEOUT ]ms' , ( ) => {
207+ it ( 'creates a new session and triggers a full dom snapshot when document becomes focused after [SESSION_IDLE_DURATION ]ms' , ( ) => {
208208 Object . defineProperty ( document , 'visibilityState' , {
209209 configurable : true ,
210210 get : function ( ) {
@@ -214,7 +214,7 @@ describe('Integration | session', () => {
214214
215215 const initialSession = replay . session ;
216216
217- jest . advanceTimersByTime ( VISIBILITY_CHANGE_TIMEOUT + 1 ) ;
217+ jest . advanceTimersByTime ( SESSION_IDLE_DURATION + 1 ) ;
218218
219219 WINDOW . dispatchEvent ( new Event ( 'focus' ) ) ;
220220
@@ -224,7 +224,7 @@ describe('Integration | session', () => {
224224 expect ( replay ) . not . toHaveSameSession ( initialSession ) ;
225225 } ) ;
226226
227- it ( 'does not create a new session if user hides the tab and comes back within [VISIBILITY_CHANGE_TIMEOUT ] seconds' , ( ) => {
227+ it ( 'does not create a new session if user hides the tab and comes back within [SESSION_IDLE_DURATION ] seconds' , ( ) => {
228228 const initialSession = replay . session ;
229229
230230 Object . defineProperty ( document , 'visibilityState' , {
@@ -237,8 +237,8 @@ describe('Integration | session', () => {
237237 expect ( mockRecord . takeFullSnapshot ) . not . toHaveBeenCalled ( ) ;
238238 expect ( replay ) . toHaveSameSession ( initialSession ) ;
239239
240- // User comes back before `VISIBILITY_CHANGE_TIMEOUT ` elapses
241- jest . advanceTimersByTime ( VISIBILITY_CHANGE_TIMEOUT - 1 ) ;
240+ // User comes back before `SESSION_IDLE_DURATION ` elapses
241+ jest . advanceTimersByTime ( SESSION_IDLE_DURATION - 1 ) ;
242242 Object . defineProperty ( document , 'visibilityState' , {
243243 configurable : true ,
244244 get : function ( ) {
@@ -451,7 +451,7 @@ describe('Integration | session', () => {
451451
452452 it ( 'increases segment id after each event' , async ( ) => {
453453 clearSession ( replay ) ;
454- replay [ '_loadAndCheckSession' ] ( 0 ) ;
454+ replay [ '_loadAndCheckSession' ] ( ) ;
455455
456456 Object . defineProperty ( document , 'visibilityState' , {
457457 configurable : true ,
0 commit comments