@@ -40,6 +40,7 @@ import { createNotificationCenter } from '../core/notification_center';
40
40
import { createHttpPollingDatafileManager } from '../plugins/datafile_manager/http_polling_datafile_manager' ;
41
41
import { NodeOdpManager } from '../plugins/odp_manager/index.node' ;
42
42
import { createProjectConfig } from '../core/project_config' ;
43
+ import { get } from 'lodash' ;
43
44
44
45
var ERROR_MESSAGES = enums . ERROR_MESSAGES ;
45
46
var LOG_LEVEL = enums . LOG_LEVEL ;
@@ -6800,10 +6801,7 @@ describe('lib/optimizely', function() {
6800
6801
it ( 'returns an empty array if the instance is invalid' , function ( ) {
6801
6802
optlyInstance = new Optimizely ( {
6802
6803
clientEngine : 'node-sdk' ,
6803
- datafile : {
6804
- lasers : 300 ,
6805
- message : 'this is not a valid datafile' ,
6806
- } ,
6804
+ projectConfigManager : getMockProjectConfigManager ( ) ,
6807
6805
errorHandler : errorHandler ,
6808
6806
eventDispatcher : eventDispatcher ,
6809
6807
jsonSchemaValidator : jsonSchemaValidator ,
@@ -6841,9 +6839,15 @@ describe('lib/optimizely', function() {
6841
6839
} ) ;
6842
6840
6843
6841
it ( 'return features that are enabled for the user and send notification for every feature' , function ( ) {
6842
+ const mockConfigManager = getMockProjectConfigManager ( ) ;
6843
+ const datafile = testData . getTestProjectConfigWithFeatures ( ) ;
6844
+
6845
+ mockConfigManager . setConfig (
6846
+ createProjectConfig ( datafile , JSON . stringify ( datafile ) ) ) ;
6847
+
6844
6848
optlyInstance = new Optimizely ( {
6845
6849
clientEngine : 'node-sdk' ,
6846
- datafile : testData . getTestProjectConfigWithFeatures ( ) ,
6850
+ projectConfigManager : mockConfigManager ,
6847
6851
errorHandler : errorHandler ,
6848
6852
eventDispatcher : eventDispatcher ,
6849
6853
jsonSchemaValidator : jsonSchemaValidator ,
@@ -8921,7 +8925,7 @@ describe('lib/optimizely', function() {
8921
8925
8922
8926
it ( 'returns null from getFeatureVariable when optimizely object is not a valid instance' , function ( ) {
8923
8927
var instance = new Optimizely ( {
8924
- datafile : { } ,
8928
+ projectConfigManager : getMockProjectConfigManager ( ) ,
8925
8929
errorHandler : errorHandler ,
8926
8930
eventDispatcher : eventDispatcher ,
8927
8931
logger : createdLogger ,
@@ -8940,7 +8944,7 @@ describe('lib/optimizely', function() {
8940
8944
8941
8945
it ( 'returns null from getFeatureVariableBoolean when optimizely object is not a valid instance' , function ( ) {
8942
8946
var instance = new Optimizely ( {
8943
- datafile : { } ,
8947
+ projectConfigManager : getMockProjectConfigManager ( ) ,
8944
8948
errorHandler : errorHandler ,
8945
8949
eventDispatcher : eventDispatcher ,
8946
8950
logger : createdLogger ,
@@ -8959,7 +8963,7 @@ describe('lib/optimizely', function() {
8959
8963
8960
8964
it ( 'returns null from getFeatureVariableDouble when optimizely object is not a valid instance' , function ( ) {
8961
8965
var instance = new Optimizely ( {
8962
- datafile : { } ,
8966
+ projectConfigManager : getMockProjectConfigManager ( ) ,
8963
8967
errorHandler : errorHandler ,
8964
8968
eventDispatcher : eventDispatcher ,
8965
8969
logger : createdLogger ,
@@ -8978,7 +8982,7 @@ describe('lib/optimizely', function() {
8978
8982
8979
8983
it ( 'returns null from getFeatureVariableInteger when optimizely object is not a valid instance' , function ( ) {
8980
8984
var instance = new Optimizely ( {
8981
- datafile : { } ,
8985
+ projectConfigManager : getMockProjectConfigManager ( ) ,
8982
8986
errorHandler : errorHandler ,
8983
8987
eventDispatcher : eventDispatcher ,
8984
8988
logger : createdLogger ,
@@ -8997,7 +9001,7 @@ describe('lib/optimizely', function() {
8997
9001
8998
9002
it ( 'returns null from getFeatureVariableString when optimizely object is not a valid instance' , function ( ) {
8999
9003
var instance = new Optimizely ( {
9000
- datafile : { } ,
9004
+ projectConfigManager : getMockProjectConfigManager ( ) ,
9001
9005
errorHandler : errorHandler ,
9002
9006
eventDispatcher : eventDispatcher ,
9003
9007
logger : createdLogger ,
@@ -9016,7 +9020,7 @@ describe('lib/optimizely', function() {
9016
9020
9017
9021
it ( 'returns null from getFeatureVariableJSON when optimizely object is not a valid instance' , function ( ) {
9018
9022
var instance = new Optimizely ( {
9019
- datafile : { } ,
9023
+ projectConfigManager : getMockProjectConfigManager ( ) ,
9020
9024
errorHandler : errorHandler ,
9021
9025
eventDispatcher : eventDispatcher ,
9022
9026
logger : createdLogger ,
0 commit comments