@@ -37,19 +37,19 @@ describe('LDClient', () => {
3737 describe ( 'initialization' , ( ) => {
3838 it ( 'should trigger the ready event' , async ( ) => {
3939 const client = LDClient . initialize ( envName , user , { bootstrap : { } , sendEvents : false } ) ;
40- await client . waitForInitialization ( ) ;
40+ await client . waitForInitialization ( 5 ) ;
4141 } ) ;
4242
4343 it ( 'should not fetch flag settings if bootstrap is provided, but should still fetch goals' , async ( ) => {
4444 const client = LDClient . initialize ( envName , user , { bootstrap : { } , sendEvents : false } ) ;
45- await client . waitForInitialization ( ) ;
45+ await client . waitForInitialization ( 5 ) ;
4646 expect ( server . requests . length ) . toEqual ( 1 ) ;
4747 expect ( server . requests [ 0 ] . url ) . toMatch ( / s d k \/ g o a l s / ) ;
4848 } ) ;
4949
5050 it ( 'sends correct User-Agent in request' , async ( ) => {
5151 const client = LDClient . initialize ( envName , user , { fetchGoals : false , sendEvents : false } ) ;
52- await client . waitForInitialization ( ) ;
52+ await client . waitForInitialization ( 5 ) ;
5353
5454 expect ( server . requests . length ) . toEqual ( 1 ) ;
5555 expect ( server . requests [ 0 ] . requestHeaders [ 'X-LaunchDarkly-User-Agent' ] ) . toMatch ( / ^ J S C l i e n t \/ / ) ;
@@ -61,7 +61,7 @@ describe('LDClient', () => {
6161 async function setupClient ( ) {
6262 const config = { bootstrap : { } , flushInterval : 100000 , fetchGoals : false , sendEvents : false } ;
6363 const client = LDClient . initialize ( envName , user , config ) ;
64- await client . waitForInitialization ( ) ;
64+ await client . waitForInitialization ( 5 ) ;
6565 return client ;
6666 }
6767 function testWithUserAgent ( desc , ua ) {
@@ -91,7 +91,7 @@ describe('LDClient', () => {
9191 describe ( 'goals' , ( ) => {
9292 it ( 'fetches goals if fetchGoals is unspecified' , async ( ) => {
9393 const client = LDClient . initialize ( envName , user , { sendEvents : false } ) ;
94- await client . waitForInitialization ( ) ;
94+ await client . waitForInitialization ( 5 ) ;
9595 expect ( server . requests . length ) . toEqual ( 2 ) ;
9696 // The following line uses arrayContaining because we can't be sure whether the goals request will
9797 // be made before or after the flags request.
@@ -102,7 +102,7 @@ describe('LDClient', () => {
102102
103103 it ( 'fetches goals if fetchGoals is true' , async ( ) => {
104104 const client = LDClient . initialize ( envName , user , { fetchGoals : true , sendEvents : false } ) ;
105- await client . waitForInitialization ( ) ;
105+ await client . waitForInitialization ( 5 ) ;
106106 expect ( server . requests . length ) . toEqual ( 2 ) ;
107107 expect ( server . requests ) . toEqual (
108108 expect . arrayContaining ( [ expect . objectContaining ( { url : expect . stringMatching ( / s d k \/ g o a l s / ) } ) ] )
@@ -111,7 +111,7 @@ describe('LDClient', () => {
111111
112112 it ( 'does not fetch goals if fetchGoals is false' , async ( ) => {
113113 const client = LDClient . initialize ( envName , user , { fetchGoals : false , sendEvents : false } ) ;
114- await client . waitForInitialization ( ) ;
114+ await client . waitForInitialization ( 5 ) ;
115115 expect ( server . requests . length ) . toEqual ( 1 ) ;
116116 expect ( server . requests [ 0 ] . url ) . toMatch ( / s d k \/ e v a l / ) ;
117117 } ) ;
@@ -139,7 +139,7 @@ describe('LDClient', () => {
139139 server . respondWith ( [ 200 , { 'Content-Type' : 'application/json' } , '[{"key": "known", "kind": "custom"}]' ] ) ;
140140
141141 const client = LDClient . initialize ( envName , user , { bootstrap : { } , sendEvents : false } ) ;
142- await client . waitForInitialization ( ) ;
142+ await client . waitForInitialization ( 5 ) ;
143143 await client . waitUntilGoalsReady ( ) ;
144144
145145 client . track ( 'known' ) ;
@@ -151,7 +151,7 @@ describe('LDClient', () => {
151151 server . respondWith ( [ 200 , { 'Content-Type' : 'application/json' } , '[{"key": "known", "kind": "custom"}]' ] ) ;
152152
153153 const client = LDClient . initialize ( envName , user , { bootstrap : { } , sendEvents : false } ) ;
154- await client . waitForInitialization ( ) ;
154+ await client . waitForInitialization ( 5 ) ;
155155 await client . waitUntilGoalsReady ( ) ;
156156
157157 client . track ( 'unknown' ) ;
@@ -164,7 +164,7 @@ describe('LDClient', () => {
164164 it ( 'normally uses asynchronous XHR' , async ( ) => {
165165 const config = { bootstrap : { } , flushInterval : 100000 , fetchGoals : false , diagnosticOptOut : true } ;
166166 const client = LDClient . initialize ( envName , user , config ) ;
167- await client . waitForInitialization ( ) ;
167+ await client . waitForInitialization ( 5 ) ;
168168
169169 await client . flush ( ) ;
170170
@@ -175,7 +175,7 @@ describe('LDClient', () => {
175175 async function setupClientAndTriggerPageHide ( ) {
176176 const config = { bootstrap : { } , flushInterval : 100000 , fetchGoals : false , diagnosticOptOut : true } ;
177177 const client = LDClient . initialize ( envName , user , config ) ;
178- await client . waitForInitialization ( ) ;
178+ await client . waitForInitialization ( 5 ) ;
179179
180180 Object . defineProperty ( document , 'visibilityState' , {
181181 configurable : true ,
0 commit comments