@@ -73,7 +73,7 @@ describe('javascript-sdk', function() {
73
73
assert . strictEqual ( console . info . getCalls ( ) . length , 1 ) ;
74
74
call = console . info . getCalls ( ) [ 0 ] ;
75
75
assert . strictEqual ( call . args . length , 1 ) ;
76
- assert ( call . args [ 0 ] . indexOf ( 'OPTIMIZELY : Skipping JSON schema validation.' ) > - 1 ) ;
76
+ assert ( call . args [ 0 ] . indexOf ( 'PROJECT_CONFIG : Skipping JSON schema validation.' ) > - 1 ) ;
77
77
} ) ;
78
78
79
79
it ( 'should instantiate the logger with a custom logLevel when provided' , function ( ) {
@@ -92,15 +92,19 @@ describe('javascript-sdk', function() {
92
92
} ) ;
93
93
optlyInstance . activate ( 'testExperiment' , 'testUser' ) ;
94
94
assert . strictEqual ( console . error . getCalls ( ) . length , 1 ) ;
95
+ // Invalid datafile causes onReady Promise rejection - catch this error
96
+ optlyInstanceInvalid . onReady ( ) . catch ( function ( ) { } ) ;
95
97
} ) ;
96
98
97
99
it ( 'should not throw if the provided config is not valid' , function ( ) {
98
100
configValidator . validate . throws ( new Error ( 'Invalid config or something' ) ) ;
99
101
assert . doesNotThrow ( function ( ) {
100
- window . optimizelySdk . createInstance ( {
102
+ var optlyInstance = window . optimizelySdk . createInstance ( {
101
103
datafile : { } ,
102
104
logger : silentLogger ,
103
105
} ) ;
106
+ // Invalid datafile causes onReady Promise rejection - catch this error
107
+ optlyInstance . onReady ( ) . catch ( function ( ) { } ) ;
104
108
} ) ;
105
109
} ) ;
106
110
@@ -113,6 +117,8 @@ describe('javascript-sdk', function() {
113
117
} ) ;
114
118
assert . equal ( 'javascript-sdk' , optlyInstance . clientEngine ) ;
115
119
assert . equal ( packageJSON . version , optlyInstance . clientVersion ) ;
120
+ // Invalid datafile causes onReady Promise rejection - catch this error
121
+ optlyInstance . onReady ( ) . catch ( function ( ) { } ) ;
116
122
} ) ;
117
123
118
124
it ( 'should activate with provided event dispatcher' , function ( ) {
0 commit comments