1- import { MAX_SESSION_LIFE , WINDOW } from '../../../src/constants' ;
1+ import { MAX_SESSION_LIFE , SESSION_IDLE_DURATION , WINDOW } from '../../../src/constants' ;
22import * as CreateSession from '../../../src/session/createSession' ;
33import * as FetchSession from '../../../src/session/fetchSession' ;
44import { getSession } from '../../../src/session/getSession' ;
@@ -42,8 +42,10 @@ describe('Unit | session | getSession', () => {
4242
4343 it ( 'creates a non-sticky session when one does not exist' , function ( ) {
4444 const { session } = getSession ( {
45- expiry : 900000 ,
46- maxSessionLife : MAX_SESSION_LIFE ,
45+ timeouts : {
46+ sessionIdle : SESSION_IDLE_DURATION ,
47+ maxSessionLife : MAX_SESSION_LIFE ,
48+ } ,
4749 stickySession : false ,
4850 ...SAMPLE_RATES ,
4951 } ) ;
@@ -67,8 +69,10 @@ describe('Unit | session | getSession', () => {
6769 saveSession ( createMockSession ( new Date ( ) . getTime ( ) - 10000 ) ) ;
6870
6971 const { session } = getSession ( {
70- expiry : 1000 ,
71- maxSessionLife : MAX_SESSION_LIFE ,
72+ timeouts : {
73+ sessionIdle : 1000 ,
74+ maxSessionLife : MAX_SESSION_LIFE ,
75+ } ,
7276 stickySession : false ,
7377 ...SAMPLE_RATES ,
7478 } ) ;
@@ -81,8 +85,10 @@ describe('Unit | session | getSession', () => {
8185
8286 it ( 'creates a non-sticky session, when one is expired' , function ( ) {
8387 const { session } = getSession ( {
84- expiry : 1000 ,
85- maxSessionLife : MAX_SESSION_LIFE ,
88+ timeouts : {
89+ sessionIdle : 1000 ,
90+ maxSessionLife : MAX_SESSION_LIFE ,
91+ } ,
8692 stickySession : false ,
8793 ...SAMPLE_RATES ,
8894 currentSession : makeSession ( {
@@ -105,8 +111,10 @@ describe('Unit | session | getSession', () => {
105111 expect ( FetchSession . fetchSession ( ) ) . toBe ( null ) ;
106112
107113 const { session } = getSession ( {
108- expiry : 900000 ,
109- maxSessionLife : MAX_SESSION_LIFE ,
114+ timeouts : {
115+ sessionIdle : SESSION_IDLE_DURATION ,
116+ maxSessionLife : MAX_SESSION_LIFE ,
117+ } ,
110118 stickySession : true ,
111119 sessionSampleRate : 1.0 ,
112120 errorSampleRate : 0.0 ,
@@ -138,8 +146,10 @@ describe('Unit | session | getSession', () => {
138146 saveSession ( createMockSession ( now ) ) ;
139147
140148 const { session } = getSession ( {
141- expiry : 1000 ,
142- maxSessionLife : MAX_SESSION_LIFE ,
149+ timeouts : {
150+ sessionIdle : 1000 ,
151+ maxSessionLife : MAX_SESSION_LIFE ,
152+ } ,
143153 stickySession : true ,
144154 sessionSampleRate : 1.0 ,
145155 errorSampleRate : 0.0 ,
@@ -162,8 +172,10 @@ describe('Unit | session | getSession', () => {
162172 saveSession ( createMockSession ( new Date ( ) . getTime ( ) - 2000 ) ) ;
163173
164174 const { session } = getSession ( {
165- expiry : 1000 ,
166- maxSessionLife : MAX_SESSION_LIFE ,
175+ timeouts : {
176+ sessionIdle : 1000 ,
177+ maxSessionLife : MAX_SESSION_LIFE ,
178+ } ,
167179 stickySession : true ,
168180 ...SAMPLE_RATES ,
169181 } ) ;
@@ -179,8 +191,10 @@ describe('Unit | session | getSession', () => {
179191
180192 it ( 'fetches a non-expired non-sticky session' , function ( ) {
181193 const { session } = getSession ( {
182- expiry : 1000 ,
183- maxSessionLife : MAX_SESSION_LIFE ,
194+ timeouts : {
195+ sessionIdle : 1000 ,
196+ maxSessionLife : MAX_SESSION_LIFE ,
197+ } ,
184198 stickySession : false ,
185199 ...SAMPLE_RATES ,
186200 currentSession : makeSession ( {
0 commit comments