@@ -37,19 +37,19 @@ describe('LDClient', () => {
37
37
describe ( 'initialization' , ( ) => {
38
38
it ( 'should trigger the ready event' , async ( ) => {
39
39
const client = LDClient . initialize ( envName , user , { bootstrap : { } , sendEvents : false } ) ;
40
- await client . waitForInitialization ( ) ;
40
+ await client . waitForInitialization ( 5 ) ;
41
41
} ) ;
42
42
43
43
it ( 'should not fetch flag settings if bootstrap is provided, but should still fetch goals' , async ( ) => {
44
44
const client = LDClient . initialize ( envName , user , { bootstrap : { } , sendEvents : false } ) ;
45
- await client . waitForInitialization ( ) ;
45
+ await client . waitForInitialization ( 5 ) ;
46
46
expect ( server . requests . length ) . toEqual ( 1 ) ;
47
47
expect ( server . requests [ 0 ] . url ) . toMatch ( / s d k \/ g o a l s / ) ;
48
48
} ) ;
49
49
50
50
it ( 'sends correct User-Agent in request' , async ( ) => {
51
51
const client = LDClient . initialize ( envName , user , { fetchGoals : false , sendEvents : false } ) ;
52
- await client . waitForInitialization ( ) ;
52
+ await client . waitForInitialization ( 5 ) ;
53
53
54
54
expect ( server . requests . length ) . toEqual ( 1 ) ;
55
55
expect ( server . requests [ 0 ] . requestHeaders [ 'X-LaunchDarkly-User-Agent' ] ) . toMatch ( / ^ J S C l i e n t \/ / ) ;
@@ -61,7 +61,7 @@ describe('LDClient', () => {
61
61
async function setupClient ( ) {
62
62
const config = { bootstrap : { } , flushInterval : 100000 , fetchGoals : false , sendEvents : false } ;
63
63
const client = LDClient . initialize ( envName , user , config ) ;
64
- await client . waitForInitialization ( ) ;
64
+ await client . waitForInitialization ( 5 ) ;
65
65
return client ;
66
66
}
67
67
function testWithUserAgent ( desc , ua ) {
@@ -91,7 +91,7 @@ describe('LDClient', () => {
91
91
describe ( 'goals' , ( ) => {
92
92
it ( 'fetches goals if fetchGoals is unspecified' , async ( ) => {
93
93
const client = LDClient . initialize ( envName , user , { sendEvents : false } ) ;
94
- await client . waitForInitialization ( ) ;
94
+ await client . waitForInitialization ( 5 ) ;
95
95
expect ( server . requests . length ) . toEqual ( 2 ) ;
96
96
// The following line uses arrayContaining because we can't be sure whether the goals request will
97
97
// be made before or after the flags request.
@@ -102,7 +102,7 @@ describe('LDClient', () => {
102
102
103
103
it ( 'fetches goals if fetchGoals is true' , async ( ) => {
104
104
const client = LDClient . initialize ( envName , user , { fetchGoals : true , sendEvents : false } ) ;
105
- await client . waitForInitialization ( ) ;
105
+ await client . waitForInitialization ( 5 ) ;
106
106
expect ( server . requests . length ) . toEqual ( 2 ) ;
107
107
expect ( server . requests ) . toEqual (
108
108
expect . arrayContaining ( [ expect . objectContaining ( { url : expect . stringMatching ( / s d k \/ g o a l s / ) } ) ] )
@@ -111,7 +111,7 @@ describe('LDClient', () => {
111
111
112
112
it ( 'does not fetch goals if fetchGoals is false' , async ( ) => {
113
113
const client = LDClient . initialize ( envName , user , { fetchGoals : false , sendEvents : false } ) ;
114
- await client . waitForInitialization ( ) ;
114
+ await client . waitForInitialization ( 5 ) ;
115
115
expect ( server . requests . length ) . toEqual ( 1 ) ;
116
116
expect ( server . requests [ 0 ] . url ) . toMatch ( / s d k \/ e v a l / ) ;
117
117
} ) ;
@@ -139,7 +139,7 @@ describe('LDClient', () => {
139
139
server . respondWith ( [ 200 , { 'Content-Type' : 'application/json' } , '[{"key": "known", "kind": "custom"}]' ] ) ;
140
140
141
141
const client = LDClient . initialize ( envName , user , { bootstrap : { } , sendEvents : false } ) ;
142
- await client . waitForInitialization ( ) ;
142
+ await client . waitForInitialization ( 5 ) ;
143
143
await client . waitUntilGoalsReady ( ) ;
144
144
145
145
client . track ( 'known' ) ;
@@ -151,7 +151,7 @@ describe('LDClient', () => {
151
151
server . respondWith ( [ 200 , { 'Content-Type' : 'application/json' } , '[{"key": "known", "kind": "custom"}]' ] ) ;
152
152
153
153
const client = LDClient . initialize ( envName , user , { bootstrap : { } , sendEvents : false } ) ;
154
- await client . waitForInitialization ( ) ;
154
+ await client . waitForInitialization ( 5 ) ;
155
155
await client . waitUntilGoalsReady ( ) ;
156
156
157
157
client . track ( 'unknown' ) ;
@@ -164,7 +164,7 @@ describe('LDClient', () => {
164
164
it ( 'normally uses asynchronous XHR' , async ( ) => {
165
165
const config = { bootstrap : { } , flushInterval : 100000 , fetchGoals : false , diagnosticOptOut : true } ;
166
166
const client = LDClient . initialize ( envName , user , config ) ;
167
- await client . waitForInitialization ( ) ;
167
+ await client . waitForInitialization ( 5 ) ;
168
168
169
169
await client . flush ( ) ;
170
170
@@ -175,7 +175,7 @@ describe('LDClient', () => {
175
175
async function setupClientAndTriggerPageHide ( ) {
176
176
const config = { bootstrap : { } , flushInterval : 100000 , fetchGoals : false , diagnosticOptOut : true } ;
177
177
const client = LDClient . initialize ( envName , user , config ) ;
178
- await client . waitForInitialization ( ) ;
178
+ await client . waitForInitialization ( 5 ) ;
179
179
180
180
Object . defineProperty ( document , 'visibilityState' , {
181
181
configurable : true ,
0 commit comments