Skip to content

Deprecate launched status check #385

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 5 commits into from
Jan 15, 2020
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
2 changes: 1 addition & 1 deletion packages/optimizely-sdk/lib/core/decision_service/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ DecisionService.prototype.__resolveExperimentBucketMap = function(userId, attrib


/**
* Checks whether the experiment is running or launched
* Checks whether the experiment is running
* @param {Object} configObj The parsed project configuration object
* @param {string} experimentKey Key of experiment being validated
* @param {string} userId ID of user
Expand Down
6 changes: 2 additions & 4 deletions packages/optimizely-sdk/lib/core/project_config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ var sprintf = require('@optimizely/js-sdk-utils').sprintf;
var configValidator = require('../../utils/config_validator');
var projectConfigSchema = require('./project_config_schema');

var EXPERIMENT_LAUNCHED_STATUS = 'Launched';
var EXPERIMENT_RUNNING_STATUS = 'Running';
var RESERVED_ATTRIBUTE_PREFIX = '$opt_';
var MODULE_NAME = 'PROJECT_CONFIG';
Expand Down Expand Up @@ -198,14 +197,13 @@ module.exports = {
},

/**
* Returns whether experiment has a status of 'Running' or 'Launched'
* Returns whether experiment has a status of 'Running'
* @param {Object} projectConfig Object representing project configuration
* @param {string} experimentKey Experiment key for which status is to be compared with 'Running'
* @return {Boolean} true if experiment status is set to 'Running', false otherwise
*/
isActive: function(projectConfig, experimentKey) {
return module.exports.getExperimentStatus(projectConfig, experimentKey) === EXPERIMENT_RUNNING_STATUS ||
module.exports.getExperimentStatus(projectConfig, experimentKey) === EXPERIMENT_LAUNCHED_STATUS;
return module.exports.getExperimentStatus(projectConfig, experimentKey) === EXPERIMENT_RUNNING_STATUS;
},

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,11 @@ describe('lib/core/project_config', function() {
}, sprintf(ERROR_MESSAGES.INVALID_EXPERIMENT_KEY, 'PROJECT_CONFIG', 'invalidExperimentKey'));
});

it('should return true if experiment status is set to Running or Launch in isActive', function() {
it('should return true if experiment status is set to Running in isActive', function() {
assert.isTrue(projectConfig.isActive(configObj, 'testExperiment'));

assert.isTrue(projectConfig.isActive(configObj, 'testExperimentLaunched'));
});

it('should return true if experiment status is set to Running or Launch in isActive', function() {
it('should return false if experiment status is not set to Running in isActive', function() {
assert.isFalse(projectConfig.isActive(configObj, 'testExperimentNotRunning'));
});

Expand Down
9 changes: 0 additions & 9 deletions packages/optimizely-sdk/lib/optimizely/index.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -786,15 +786,6 @@ describe('lib/optimizely', function() {
});
});

it('returns the variation key but does not dispatch the event if user is in experiment and experiment is set to Launched', function() {
bucketStub.returns('144448');

var bucketedVariation = optlyInstance.activate('testExperimentLaunched', 'testUser');
assert.strictEqual(bucketedVariation, 'controlLaunched');

sinon.assert.notCalled(eventDispatcher.dispatchEvent);
});

it('should not activate when optimizely object is not a valid instance', function() {
var instance = new Optimizely({
datafile: {},
Expand Down
2 changes: 1 addition & 1 deletion packages/optimizely-sdk/lib/utils/enums/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ exports.LOG_MESSAGES = {
ROLLOUT_HAS_NO_EXPERIMENTS: '%s: Rollout of feature %s has no experiments',
SAVED_VARIATION: '%s: Saved variation "%s" of experiment "%s" for user "%s".',
SAVED_VARIATION_NOT_FOUND: '%s: User %s was previously bucketed into variation with ID %s for experiment %s, but no matching variation was found.',
SHOULD_NOT_DISPATCH_ACTIVATE: '%s: Experiment %s is in "Launched" state. Not activating user.',
SHOULD_NOT_DISPATCH_ACTIVATE: '%s: Experiment %s is not in "Running" state. Not activating user.',
SKIPPING_JSON_VALIDATION: '%s: Skipping JSON schema validation.',
TRACK_EVENT: '%s: Tracking event %s for user %s.',
USER_ASSIGNED_TO_VARIATION_BUCKET: '%s: Assigned variation bucket %s to user %s.',
Expand Down