@@ -144,12 +144,12 @@ describe('SplitService', () => {
144
144
145
145
service . getTreatment ( 'test_split' ) ;
146
146
expect ( clientSpy . getTreatment . mock . calls [ 0 ] ) . toEqual ( [ 'test_split' , undefined ] ) ;
147
- service . getTreatmentWithConfig ( 'test_split' , { attr : true } ) ;
148
- expect ( clientSpy . getTreatmentWithConfig . mock . calls [ 0 ] ) . toEqual ( [ 'test_split' , { attr : true } ] ) ;
149
- service . getTreatments ( [ 'test_split' , 'test_split2' ] , { attr : true } ) ;
150
- expect ( clientSpy . getTreatments . mock . calls [ 0 ] ) . toEqual ( [ [ 'test_split' , 'test_split2' ] , { attr : true } ] ) ;
147
+ service . getTreatmentWithConfig ( 'test_split' , { attr : true } , { properties : { enabled : true } } ) ;
148
+ expect ( clientSpy . getTreatmentWithConfig . mock . calls [ 0 ] ) . toEqual ( [ 'test_split' , { attr : true } , { properties : { enabled : true } } ] ) ;
149
+ service . getTreatments ( [ 'test_split' , 'test_split2' ] , { attr : true } , { properties : { enabled : true } } ) ;
150
+ expect ( clientSpy . getTreatments . mock . calls [ 0 ] ) . toEqual ( [ [ 'test_split' , 'test_split2' ] , { attr : true } , { properties : { enabled : true } } ] ) ;
151
151
service . getTreatmentsWithConfig ( [ 'test_split' , 'test_split2' ] ) ;
152
- expect ( clientSpy . getTreatmentsWithConfig . mock . calls [ 0 ] ) . toEqual ( [ [ 'test_split' , 'test_split2' ] , undefined ] ) ;
152
+ expect ( clientSpy . getTreatmentsWithConfig . mock . calls [ 0 ] ) . toEqual ( [ [ 'test_split' , 'test_split2' ] ] ) ;
153
153
154
154
const sharedClientKey = 'myKey2' ;
155
155
// initialize shared client and wait for ready
@@ -208,28 +208,28 @@ describe('SplitService', () => {
208
208
expect ( sharedClientSpy . getTreatmentsWithConfig ) . toHaveBeenCalledTimes ( 0 ) ;
209
209
210
210
// verify that main client is not evaluating when evaluates for shared client
211
- expect ( service . getTreatment ( sharedClientKey , 'test_split' , { attr : true } ) ) . toEqual ( 'on' ) ;
212
- expect ( sharedClientSpy . getTreatment . mock . calls [ 0 ] ) . toEqual ( [ 'test_split' , { attr : true } ] ) ;
211
+ expect ( service . getTreatment ( sharedClientKey , 'test_split' , { attr : true } , { properties : { enabled : true } } ) ) . toEqual ( 'on' ) ;
212
+ expect ( sharedClientSpy . getTreatment . mock . calls [ 0 ] ) . toEqual ( [ 'test_split' , { attr : true } , { properties : { enabled : true } } ] ) ;
213
213
expect ( clientSpy . getTreatment ) . toHaveBeenCalledTimes ( 1 ) ;
214
-
215
- expect ( service . getTreatmentWithConfig ( sharedClientKey , 'test_split' , { attr : true } ) ) . toEqual ( { treatment : 'on' , config : null } ) ;
216
- expect ( sharedClientSpy . getTreatmentWithConfig . mock . calls [ 0 ] ) . toEqual ( [ 'test_split' , { attr : true } ] ) ;
214
+
215
+ expect ( service . getTreatmentWithConfig ( sharedClientKey , 'test_split' , { attr : true } , { properties : { enabled : true } } ) ) . toEqual ( { treatment : 'on' , config : null } ) ;
216
+ expect ( sharedClientSpy . getTreatmentWithConfig . mock . calls [ 0 ] ) . toEqual ( [ 'test_split' , { attr : true } , { properties : { enabled : true } } ] ) ;
217
217
expect ( clientSpy . getTreatmentWithConfig ) . toHaveBeenCalledTimes ( 1 ) ;
218
218
219
- expect ( service . getTreatments ( sharedClientKey , [ 'test_split' , 'test_split2' ] , { attr : true } ) )
219
+ expect ( service . getTreatments ( sharedClientKey , [ 'test_split' , 'test_split2' ] , { attr : true } , { properties : { enabled : true } } ) )
220
220
. toEqual ( {
221
221
'test_split' : 'on' ,
222
222
'test_split2' : 'off'
223
223
} ) ;
224
- expect ( sharedClientSpy . getTreatments . mock . calls [ 0 ] ) . toEqual ( [ [ 'test_split' , 'test_split2' ] , { attr : true } ] ) ;
224
+ expect ( sharedClientSpy . getTreatments . mock . calls [ 0 ] ) . toEqual ( [ [ 'test_split' , 'test_split2' ] , { attr : true } , { properties : { enabled : true } } ] ) ;
225
225
expect ( clientSpy . getTreatments ) . toHaveBeenCalledTimes ( 1 ) ;
226
226
227
- expect ( service . getTreatmentsWithConfig ( sharedClientKey , [ 'test_split' , 'test_split2' ] , { attr : true } ) )
227
+ expect ( service . getTreatmentsWithConfig ( sharedClientKey , [ 'test_split' , 'test_split2' ] , { attr : true } , { properties : { enabled : true } } ) )
228
228
. toEqual ( {
229
229
test_split : { treatment : 'on' , config : null } ,
230
230
test_split2 : { treatment : 'off' , config : '{"bannerText":"Click here."}' }
231
231
} ) ;
232
- expect ( sharedClientSpy . getTreatmentsWithConfig . mock . calls [ 0 ] ) . toEqual ( [ [ 'test_split' , 'test_split2' ] , { attr : true } ] ) ;
232
+ expect ( sharedClientSpy . getTreatmentsWithConfig . mock . calls [ 0 ] ) . toEqual ( [ [ 'test_split' , 'test_split2' ] , { attr : true } , { properties : { enabled : true } } ] ) ;
233
233
expect ( clientSpy . getTreatmentsWithConfig ) . toHaveBeenCalledTimes ( 1 ) ;
234
234
235
235
// input validation
@@ -281,10 +281,10 @@ describe('SplitService', () => {
281
281
282
282
service . getTreatmentsByFlagSet ( 'set_a' ) ;
283
283
expect ( clientSpy . getTreatmentsByFlagSet . mock . calls [ 0 ] ) . toEqual ( [ 'set_a' , undefined ] ) ;
284
- service . getTreatmentsWithConfigByFlagSet ( 'set_a' , { attr : true } ) ;
285
- expect ( clientSpy . getTreatmentsWithConfigByFlagSet . mock . calls [ 0 ] ) . toEqual ( [ 'set_a' , { attr : true } ] ) ;
286
- service . getTreatmentsByFlagSets ( [ 'set_a' , 'set_b' ] , { attr : true } ) ;
287
- expect ( clientSpy . getTreatmentsByFlagSets . mock . calls [ 0 ] ) . toEqual ( [ [ 'set_a' , 'set_b' ] , { attr : true } ] ) ;
284
+ service . getTreatmentsWithConfigByFlagSet ( 'set_a' , { attr : true } , { properties : { enabled : true } } ) ;
285
+ expect ( clientSpy . getTreatmentsWithConfigByFlagSet . mock . calls [ 0 ] ) . toEqual ( [ 'set_a' , { attr : true } , { properties : { enabled : true } } ] ) ;
286
+ service . getTreatmentsByFlagSets ( [ 'set_a' , 'set_b' ] , { attr : true } , { properties : { enabled : true } } ) ;
287
+ expect ( clientSpy . getTreatmentsByFlagSets . mock . calls [ 0 ] ) . toEqual ( [ [ 'set_a' , 'set_b' ] , { attr : true } , { properties : { enabled : true } } ] ) ;
288
288
service . getTreatmentsWithConfigByFlagSets ( [ 'set_a' , 'set_b' ] ) ;
289
289
expect ( clientSpy . getTreatmentsWithConfigByFlagSets . mock . calls [ 0 ] ) . toEqual ( [ [ 'set_a' , 'set_b' ] , undefined ] ) ;
290
290
0 commit comments