Skip to content

Commit b6884e9

Browse files
author
Matt Carroll
committed
Fix umd bundle tests
1 parent 6c1b014 commit b6884e9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/optimizely-sdk/lib/index.browser.umdtests.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('javascript-sdk', function() {
7373
assert.strictEqual(console.info.getCalls().length, 1);
7474
call = console.info.getCalls()[0];
7575
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);
7777
});
7878

7979
it('should instantiate the logger with a custom logLevel when provided', function() {
@@ -92,15 +92,19 @@ describe('javascript-sdk', function() {
9292
});
9393
optlyInstance.activate('testExperiment', 'testUser');
9494
assert.strictEqual(console.error.getCalls().length, 1);
95+
// Invalid datafile causes onReady Promise rejection - catch this error
96+
optlyInstanceInvalid.onReady().catch(function() {});
9597
});
9698

9799
it('should not throw if the provided config is not valid', function() {
98100
configValidator.validate.throws(new Error('Invalid config or something'));
99101
assert.doesNotThrow(function() {
100-
window.optimizelySdk.createInstance({
102+
var optlyInstance = window.optimizelySdk.createInstance({
101103
datafile: {},
102104
logger: silentLogger,
103105
});
106+
// Invalid datafile causes onReady Promise rejection - catch this error
107+
optlyInstance.onReady().catch(function() {});
104108
});
105109
});
106110

@@ -113,6 +117,8 @@ describe('javascript-sdk', function() {
113117
});
114118
assert.equal('javascript-sdk', optlyInstance.clientEngine);
115119
assert.equal(packageJSON.version, optlyInstance.clientVersion);
120+
// Invalid datafile causes onReady Promise rejection - catch this error
121+
optlyInstance.onReady().catch(function() {});
116122
});
117123

118124
it('should activate with provided event dispatcher', function() {

0 commit comments

Comments
 (0)