@@ -37,16 +37,13 @@ import { getMockProjectConfigManager } from '../tests/mock/mock_project_config_m
3737import { DECISION_NOTIFICATION_TYPES } from '../notification_center/type' ;
3838import {
3939 AUDIENCE_EVALUATION_RESULT_COMBINED ,
40- EVENT_KEY_NOT_FOUND ,
4140 EXPERIMENT_NOT_RUNNING ,
4241 FEATURE_HAS_NO_EXPERIMENTS ,
4342 FEATURE_NOT_ENABLED_FOR_USER ,
44- FORCED_BUCKETING_FAILED ,
4543 INVALID_CLIENT_ENGINE ,
4644 INVALID_DEFAULT_DECIDE_OPTIONS ,
4745 INVALID_OBJECT ,
4846 NOT_ACTIVATING_USER ,
49- NOT_TRACKING_USER ,
5047 RETURNING_STORED_VARIATION ,
5148 USER_DOESNT_MEET_CONDITIONS_FOR_TARGETING_RULE ,
5249 USER_FORCED_IN_VARIATION ,
@@ -67,10 +64,13 @@ import {
6764import {
6865 EXPERIMENT_KEY_NOT_IN_DATAFILE ,
6966 INVALID_ATTRIBUTES ,
67+ NOT_TRACKING_USER ,
68+ EVENT_KEY_NOT_FOUND ,
7069 INVALID_EXPERIMENT_KEY ,
7170 INVALID_INPUT_FORMAT ,
7271 NO_VARIATION_FOR_EXPERIMENT_KEY ,
7372 USER_NOT_IN_FORCED_VARIATION ,
73+ FORCED_BUCKETING_FAILED ,
7474} from '../error_messages' ;
7575import { FAILED_TO_STOP , ONREADY_TIMEOUT_EXPIRED , PROMISE_SHOULD_NOT_HAVE_RESOLVED } from '../exception_messages' ;
7676import { USER_BUCKETED_INTO_EXPERIMENT_IN_GROUP } from '../core/bucketer' ;
@@ -1627,27 +1627,24 @@ describe('lib/optimizely', function() {
16271627 // assert.strictEqual(logMessage, sprintf(INVALID_INPUT_FORMAT, 'OPTIMIZELY', 'user_id'));
16281628 } ) ;
16291629
1630- it . skip ( 'should log a warning for an event key that is not in the datafile and a warning for not tracking user' , function ( ) {
1631- optlyInstance . track ( 'invalidEventKey' , 'testUser' ) ;
1630+ it ( 'should log a warning for an event key that is not in the datafile and a warning for not tracking user' , function ( ) {
1631+ const { optlyInstance, errorNotifier, createdLogger, eventDispatcher } = getOptlyInstance ( {
1632+ datafileObj : testData . getTestDecideProjectConfig ( ) ,
1633+ } ) ;
16321634
1633- sinon . assert . calledTwice ( createdLogger . log ) ;
1635+ sinon . stub ( createdLogger , 'warn' ) ;
1636+
1637+ optlyInstance . track ( 'invalidEventKey' , 'testUser' ) ;
16341638
1635- var logCall1 = createdLogger . log . getCall ( 0 ) ;
16361639 sinon . assert . calledWithExactly (
1637- // createLogger.warn,
1638- logCall1 ,
1639- LOG_LEVEL . WARNING ,
1640+ createdLogger . warn ,
16401641 EVENT_KEY_NOT_FOUND ,
1641- 'OPTIMIZELY' ,
16421642 'invalidEventKey'
16431643 ) ;
16441644
1645- var logCall2 = createdLogger . log . getCall ( 1 ) ;
16461645 sinon . assert . calledWithExactly (
1647- logCall2 ,
1648- LOG_LEVEL . WARNING ,
1646+ createdLogger . warn ,
16491647 NOT_TRACKING_USER ,
1650- 'OPTIMIZELY' ,
16511648 'testUser'
16521649 ) ;
16531650
@@ -5153,7 +5150,7 @@ describe('lib/optimizely', function() {
51535150 ) ;
51545151 } ) ;
51555152
5156- it . skip ( 'should include reason when invalid forced variation found' , function ( ) {
5153+ it ( 'should include reason when invalid forced variation found' , function ( ) {
51575154 var flagKey = 'feature_1' ;
51585155 var variationKey = 'invalid-key' ;
51595156 var newConfig = optlyInstance . projectConfigManager . getConfig ( ) ;
0 commit comments