@@ -144,12 +144,12 @@ describe('SplitService', () => {
144144
145145 service . getTreatment ( 'test_split' ) ;
146146 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 } } ] ) ;
151151 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' ] ] ) ;
153153
154154 const sharedClientKey = 'myKey2' ;
155155 // initialize shared client and wait for ready
@@ -208,28 +208,28 @@ describe('SplitService', () => {
208208 expect ( sharedClientSpy . getTreatmentsWithConfig ) . toHaveBeenCalledTimes ( 0 ) ;
209209
210210 // 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 } } ] ) ;
213213 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 } } ] ) ;
217217 expect ( clientSpy . getTreatmentWithConfig ) . toHaveBeenCalledTimes ( 1 ) ;
218218
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 } } ) )
220220 . toEqual ( {
221221 'test_split' : 'on' ,
222222 'test_split2' : 'off'
223223 } ) ;
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 } } ] ) ;
225225 expect ( clientSpy . getTreatments ) . toHaveBeenCalledTimes ( 1 ) ;
226226
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 } } ) )
228228 . toEqual ( {
229229 test_split : { treatment : 'on' , config : null } ,
230230 test_split2 : { treatment : 'off' , config : '{"bannerText":"Click here."}' }
231231 } ) ;
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 } } ] ) ;
233233 expect ( clientSpy . getTreatmentsWithConfig ) . toHaveBeenCalledTimes ( 1 ) ;
234234
235235 // input validation
@@ -281,10 +281,10 @@ describe('SplitService', () => {
281281
282282 service . getTreatmentsByFlagSet ( 'set_a' ) ;
283283 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 } } ] ) ;
288288 service . getTreatmentsWithConfigByFlagSets ( [ 'set_a' , 'set_b' ] ) ;
289289 expect ( clientSpy . getTreatmentsWithConfigByFlagSets . mock . calls [ 0 ] ) . toEqual ( [ [ 'set_a' , 'set_b' ] , undefined ] ) ;
290290
0 commit comments