@@ -76,7 +76,7 @@ describe('EppoClient E2E test', () => {
76
76
77
77
beforeAll ( ( ) => {
78
78
storage . setEntries ( { [ flagKey ] : mockFlag } ) ;
79
- client = new EppoClient ( storage ) ;
79
+ client = new EppoClient ( { flagConfigurationStore : storage } ) ;
80
80
81
81
td . replace ( EppoClient . prototype , 'getAssignmentDetail' , function ( ) {
82
82
throw new Error ( 'Mock test error' ) ;
@@ -137,7 +137,7 @@ describe('EppoClient E2E test', () => {
137
137
it ( 'Invokes logger for queued events' , ( ) => {
138
138
const mockLogger = td . object < IAssignmentLogger > ( ) ;
139
139
140
- const client = new EppoClient ( storage ) ;
140
+ const client = new EppoClient ( { flagConfigurationStore : storage } ) ;
141
141
client . getStringAssignment ( flagKey , 'subject-to-be-logged' , { } , 'default-value' ) ;
142
142
client . setAssignmentLogger ( mockLogger ) ;
143
143
@@ -150,7 +150,7 @@ describe('EppoClient E2E test', () => {
150
150
it ( 'Does not log same queued event twice' , ( ) => {
151
151
const mockLogger = td . object < IAssignmentLogger > ( ) ;
152
152
153
- const client = new EppoClient ( storage ) ;
153
+ const client = new EppoClient ( { flagConfigurationStore : storage } ) ;
154
154
155
155
client . getStringAssignment ( flagKey , 'subject-to-be-logged' , { } , 'default-value' ) ;
156
156
client . setAssignmentLogger ( mockLogger ) ;
@@ -161,7 +161,7 @@ describe('EppoClient E2E test', () => {
161
161
162
162
it ( 'Does not invoke logger for events that exceed queue size' , ( ) => {
163
163
const mockLogger = td . object < IAssignmentLogger > ( ) ;
164
- const client = new EppoClient ( storage ) ;
164
+ const client = new EppoClient ( { flagConfigurationStore : storage } ) ;
165
165
166
166
times ( MAX_EVENT_QUEUE_SIZE + 100 , ( i ) =>
167
167
client . getStringAssignment ( flagKey , `subject-to-be-logged-${ i } ` , { } , 'default-value' ) ,
@@ -199,7 +199,7 @@ describe('EppoClient E2E test', () => {
199
199
200
200
it . each ( Object . keys ( testCases ) ) ( 'test variation assignment splits - %s' , async ( fileName ) => {
201
201
const { flag, variationType, defaultValue, subjects } = testCases [ fileName ] ;
202
- const client = new EppoClient ( storage ) ;
202
+ const client = new EppoClient ( { flagConfigurationStore : storage } ) ;
203
203
client . setIsGracefulFailureMode ( false ) ;
204
204
205
205
let assignments : {
@@ -253,7 +253,7 @@ describe('EppoClient E2E test', () => {
253
253
254
254
it . each ( Object . keys ( testCases ) ) ( 'test variation assignment splits - %s' , async ( fileName ) => {
255
255
const { flag, variationType, defaultValue, subjects } = testCases [ fileName ] ;
256
- const client = new EppoClient ( storage , undefined , undefined , undefined , true ) ;
256
+ const client = new EppoClient ( { flagConfigurationStore : storage , isObfuscated : true } ) ;
257
257
client . setIsGracefulFailureMode ( false ) ;
258
258
259
259
const typeAssignmentFunctions = {
@@ -285,15 +285,17 @@ describe('EppoClient E2E test', () => {
285
285
} ) ;
286
286
287
287
it ( 'returns null if getStringAssignment was called for the subject before any UFC was loaded' , ( ) => {
288
- const localClient = new EppoClient ( new MemoryOnlyConfigurationStore ( ) ) ;
288
+ const localClient = new EppoClient ( {
289
+ flagConfigurationStore : new MemoryOnlyConfigurationStore ( ) ,
290
+ } ) ;
289
291
expect ( localClient . getStringAssignment ( flagKey , 'subject-1' , { } , 'hello world' ) ) . toEqual (
290
292
'hello world' ,
291
293
) ;
292
294
expect ( localClient . isInitialized ( ) ) . toBe ( false ) ;
293
295
} ) ;
294
296
295
297
it ( 'returns default value when key does not exist' , async ( ) => {
296
- const client = new EppoClient ( storage ) ;
298
+ const client = new EppoClient ( { flagConfigurationStore : storage } ) ;
297
299
298
300
const nonExistentFlag = 'non-existent-flag' ;
299
301
@@ -310,7 +312,7 @@ describe('EppoClient E2E test', () => {
310
312
const mockLogger = td . object < IAssignmentLogger > ( ) ;
311
313
312
314
storage . setEntries ( { [ flagKey ] : mockFlag } ) ;
313
- const client = new EppoClient ( storage ) ;
315
+ const client = new EppoClient ( { flagConfigurationStore : storage } ) ;
314
316
client . setAssignmentLogger ( mockLogger ) ;
315
317
316
318
const subjectAttributes = { foo : 3 } ;
@@ -336,7 +338,7 @@ describe('EppoClient E2E test', () => {
336
338
td . when ( mockLogger . logAssignment ( td . matchers . anything ( ) ) ) . thenThrow ( new Error ( 'logging error' ) ) ;
337
339
338
340
storage . setEntries ( { [ flagKey ] : mockFlag } ) ;
339
- const client = new EppoClient ( storage ) ;
341
+ const client = new EppoClient ( { flagConfigurationStore : storage } ) ;
340
342
client . setAssignmentLogger ( mockLogger ) ;
341
343
342
344
const subjectAttributes = { foo : 3 } ;
@@ -352,7 +354,7 @@ describe('EppoClient E2E test', () => {
352
354
353
355
it ( 'exports flag configuration' , ( ) => {
354
356
storage . setEntries ( { [ flagKey ] : mockFlag } ) ;
355
- const client = new EppoClient ( storage ) ;
357
+ const client = new EppoClient ( { flagConfigurationStore : storage } ) ;
356
358
expect ( client . getFlagConfigurations ( ) ) . toEqual ( { [ flagKey ] : mockFlag } ) ;
357
359
} ) ;
358
360
@@ -364,7 +366,7 @@ describe('EppoClient E2E test', () => {
364
366
mockLogger = td . object < IAssignmentLogger > ( ) ;
365
367
366
368
storage . setEntries ( { [ flagKey ] : mockFlag } ) ;
367
- client = new EppoClient ( storage ) ;
369
+ client = new EppoClient ( { flagConfigurationStore : storage } ) ;
368
370
client . setAssignmentLogger ( mockLogger ) ;
369
371
} ) ;
370
372
@@ -617,7 +619,10 @@ describe('EppoClient E2E test', () => {
617
619
} ) ;
618
620
619
621
it ( 'Fetches initial configuration with parameters in constructor' , async ( ) => {
620
- client = new EppoClient ( thisFlagStorage , undefined , undefined , requestConfiguration ) ;
622
+ client = new EppoClient ( {
623
+ flagConfigurationStore : thisFlagStorage ,
624
+ configurationRequestParameters : requestConfiguration ,
625
+ } ) ;
621
626
client . setIsGracefulFailureMode ( false ) ;
622
627
// no configuration loaded
623
628
let variation = client . getNumericAssignment ( flagKey , subject , { } , 123.4 ) ;
@@ -629,7 +634,7 @@ describe('EppoClient E2E test', () => {
629
634
} ) ;
630
635
631
636
it ( 'Fetches initial configuration with parameters provided later' , async ( ) => {
632
- client = new EppoClient ( thisFlagStorage ) ;
637
+ client = new EppoClient ( { flagConfigurationStore : thisFlagStorage } ) ;
633
638
client . setIsGracefulFailureMode ( false ) ;
634
639
client . setConfigurationRequestParameters ( requestConfiguration ) ;
635
640
// no configuration loaded
@@ -651,9 +656,12 @@ describe('EppoClient E2E test', () => {
651
656
}
652
657
}
653
658
654
- client = new EppoClient ( new MockStore ( ) , undefined , undefined , {
655
- ...requestConfiguration ,
656
- pollAfterSuccessfulInitialization : true ,
659
+ client = new EppoClient ( {
660
+ flagConfigurationStore : new MockStore ( ) ,
661
+ configurationRequestParameters : {
662
+ ...requestConfiguration ,
663
+ pollAfterSuccessfulInitialization : true ,
664
+ } ,
657
665
} ) ;
658
666
client . setIsGracefulFailureMode ( false ) ;
659
667
// no configuration loaded
@@ -680,7 +688,10 @@ describe('EppoClient E2E test', () => {
680
688
}
681
689
}
682
690
683
- client = new EppoClient ( new MockStore ( ) , undefined , undefined , requestConfiguration ) ;
691
+ client = new EppoClient ( {
692
+ flagConfigurationStore : new MockStore ( ) ,
693
+ configurationRequestParameters : requestConfiguration ,
694
+ } ) ;
684
695
client . setIsGracefulFailureMode ( false ) ;
685
696
// no configuration loaded
686
697
let variation = client . getNumericAssignment ( flagKey , subject , { } , 0.0 ) ;
@@ -722,7 +733,10 @@ describe('EppoClient E2E test', () => {
722
733
...requestConfiguration ,
723
734
pollAfterSuccessfulInitialization,
724
735
} ;
725
- client = new EppoClient ( thisFlagStorage , undefined , undefined , requestConfiguration ) ;
736
+ client = new EppoClient ( {
737
+ flagConfigurationStore : thisFlagStorage ,
738
+ configurationRequestParameters : requestConfiguration ,
739
+ } ) ;
726
740
client . setIsGracefulFailureMode ( false ) ;
727
741
// no configuration loaded
728
742
let variation = client . getNumericAssignment ( flagKey , subject , { } , 0.0 ) ;
@@ -787,7 +801,10 @@ describe('EppoClient E2E test', () => {
787
801
throwOnFailedInitialization,
788
802
pollAfterFailedInitialization,
789
803
} ;
790
- client = new EppoClient ( thisFlagStorage , undefined , undefined , requestConfiguration ) ;
804
+ client = new EppoClient ( {
805
+ flagConfigurationStore : thisFlagStorage ,
806
+ configurationRequestParameters : requestConfiguration ,
807
+ } ) ;
791
808
client . setIsGracefulFailureMode ( false ) ;
792
809
// no configuration loaded
793
810
expect ( client . getNumericAssignment ( flagKey , subject , { } , 0.0 ) ) . toBe ( 0.0 ) ;
0 commit comments