@@ -186,7 +186,7 @@ describe('DecisionService', () => {
186
186
it ( 'should return null if the user does not meet audience conditions' , ( ) => {
187
187
const user = new OptimizelyUserContext ( {
188
188
optimizely : { } as any ,
189
- userId : 'user2 '
189
+ userId : 'user3 '
190
190
} ) ;
191
191
192
192
const config = createProjectConfig ( cloneDeep ( testData ) ) ;
@@ -197,31 +197,14 @@ describe('DecisionService', () => {
197
197
198
198
const variation = decisionService . getVariation ( config , experiment , user ) ;
199
199
200
- expect ( variation . result ) . toBe ( 'variationWithAudience' ) ;
201
- expect ( mockBucket ) . not . toHaveBeenCalled ( ) ;
202
- expect ( logger ?. debug ) . toHaveBeenCalledTimes ( 1 ) ;
203
- expect ( logger ?. info ) . toHaveBeenCalledTimes ( 1 ) ;
204
-
205
- expect ( logger ?. debug ) . toHaveBeenNthCalledWith ( 1 , USER_HAS_NO_FORCED_VARIATION , 'user2' ) ;
206
- expect ( logger ?. info ) . toHaveBeenNthCalledWith ( 1 , USER_FORCED_IN_VARIATION , 'user2' , 'variationWithAudience' ) ;
207
-
208
- user = new OptimizelyUserContext ( {
209
- shouldIdentifyUser : false ,
210
- optimizely : { } ,
211
- userId : 'user3'
212
- } ) ;
213
- experiment = configObj . experimentIdMap [ '122227' ] ;
214
- assert . isNull (
215
- decisionServiceInstance . getVariation ( configObj , experiment , user , { foo : 'bar' } ) . result
216
- ) ;
217
-
218
- assert . deepEqual ( mockLogger . debug . args [ 0 ] , [ USER_HAS_NO_FORCED_VARIATION , 'user3' ] ) ;
200
+ expect ( variation . result ) . toBe ( null ) ;
219
201
220
- assert . deepEqual ( mockLogger . debug . args [ 1 ] , [ EVALUATING_AUDIENCES_COMBINED , 'experiment' , 'testExperimentWithAudiences' , JSON . stringify ( [ "11154" ] ) ] ) ;
221
202
222
- assert . deepEqual ( mockLogger . info . args [ 0 ] , [ AUDIENCE_EVALUATION_RESULT_COMBINED , 'experiment' , 'testExperimentWithAudiences' , 'FALSE' ] ) ;
203
+ expect ( logger ?. debug ) . toHaveBeenNthCalledWith ( 1 , USER_HAS_NO_FORCED_VARIATION , 'user3' ) ;
204
+ expect ( logger ?. debug ) . toHaveBeenNthCalledWith ( 2 , EVALUATING_AUDIENCES_COMBINED , 'experiment' , 'testExperimentWithAudiences' , JSON . stringify ( [ "11154" ] ) ) ;
223
205
224
- assert . deepEqual ( mockLogger . info . args [ 1 ] , [ USER_NOT_IN_EXPERIMENT , 'user3' , 'testExperimentWithAudiences' ] ) ;
206
+ expect ( logger ?. info ) . toHaveBeenNthCalledWith ( 1 , AUDIENCE_EVALUATION_RESULT_COMBINED , 'experiment' , 'testExperimentWithAudiences' , 'FALSE' ) ;
207
+ expect ( logger ?. info ) . toHaveBeenNthCalledWith ( 2 , USER_NOT_IN_EXPERIMENT , 'user3' , 'testExperimentWithAudiences' ) ;
225
208
} ) ;
226
209
227
210
// it('should return null if the experiment is not running', function() {
0 commit comments