Skip to content

fix(project config manager): Don't log an error when not initialized with datafile #589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/optimizely-sdk/CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Bug fixes

- Fixed return type of `getAllFeatureVariables` method and `dispatchEvent ` method signature of `EventDispatcher` interface in TypeScript type definitions ([#576](https://github.com/optimizely/javascript-sdk/pull/576))
- Don't log an error message when initialized with `sdkKey`, but no `datafile` ([#589](https://github.com/optimizely/javascript-sdk/pull/589))

## [4.3.1] - October 5, 2020

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,13 @@ ProjectConfigManager.prototype.__initialize = function(config) {
return;
}

var handleNewDatafileException = this.__handleNewDatafile(config.datafile);
if (handleNewDatafileException) {
let handleNewDatafileException;
if (config.datafile) {
handleNewDatafileException = this.__handleNewDatafile(config.datafile);
if (handleNewDatafileException) {
this.__configObj = null;
}
} else {
this.__configObj = null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,13 @@ describe('lib/core/project_config/project_config_manager', function() {
manager.stop();
sinon.assert.calledOnce(datafileManager.HttpPollingDatafileManager.getCall(0).returnValue.stop);
});

it('does not log an error message', function() {
projectConfigManager.createProjectConfigManager({
sdkKey: '12345',
});
sinon.assert.notCalled(stubLogHandler.log);
});
});

describe('when constructed with sdkKey and with a valid datafile object', function() {
Expand Down