@@ -18,6 +18,9 @@ const truncate = Layer.effectDiscard(
1818
1919const it = testEffect ( Layer . merge ( AccountRepo . layer , truncate ) )
2020
21+ const insideEagerRefreshWindow = Duration . toMillis ( Duration . minutes ( 1 ) )
22+ const outsideEagerRefreshWindow = Duration . toMillis ( Duration . minutes ( 10 ) )
23+
2124const live = ( client : HttpClient . HttpClient ) =>
2225 Account . layer . pipe ( Layer . provide ( Layer . succeed ( HttpClient . HttpClient , client ) ) )
2326
@@ -63,7 +66,7 @@ it.live("orgsByAccount groups orgs per account", () =>
6366 url : "https://one.example.com" ,
6467 accessToken : AccessToken . make ( "at_1" ) ,
6568 refreshToken : RefreshToken . make ( "rt_1" ) ,
66- expiry : Date . now ( ) + 10 * 60_000 ,
69+ expiry : Date . now ( ) + outsideEagerRefreshWindow ,
6770 orgID : Option . none ( ) ,
6871 } ) ,
6972 )
@@ -75,7 +78,7 @@ it.live("orgsByAccount groups orgs per account", () =>
7578 url : "https://two.example.com" ,
7679 accessToken : AccessToken . make ( "at_2" ) ,
7780 refreshToken : RefreshToken . make ( "rt_2" ) ,
78- expiry : Date . now ( ) + 10 * 60_000 ,
81+ expiry : Date . now ( ) + outsideEagerRefreshWindow ,
7982 orgID : Option . none ( ) ,
8083 } ) ,
8184 )
@@ -159,7 +162,7 @@ it.live("token refreshes before expiry when inside the eager refresh window", ()
159162 url : "https://one.example.com" ,
160163 accessToken : AccessToken . make ( "at_old" ) ,
161164 refreshToken : RefreshToken . make ( "rt_old" ) ,
162- expiry : Date . now ( ) + 60_000 ,
165+ expiry : Date . now ( ) + insideEagerRefreshWindow ,
163166 orgID : Option . none ( ) ,
164167 } ) ,
165168 )
@@ -267,7 +270,7 @@ it.live("config sends the selected org header", () =>
267270 url : "https://one.example.com" ,
268271 accessToken : AccessToken . make ( "at_1" ) ,
269272 refreshToken : RefreshToken . make ( "rt_1" ) ,
270- expiry : Date . now ( ) + 10 * 60_000 ,
273+ expiry : Date . now ( ) + outsideEagerRefreshWindow ,
271274 orgID : Option . none ( ) ,
272275 } ) ,
273276 )
0 commit comments