Skip to content

Commit efaa0f7

Browse files
mfahadahmedmikeproeng37
authored andcommitted
Removes sorting from getEnabledFeatures method. (#84)
1 parent 733f7e4 commit efaa0f7

File tree

2 files changed

+1
-30
lines changed

2 files changed

+1
-30
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ Optimizely.prototype.getEnabledFeatures = function(userId, attributes) {
516516
}
517517
}.bind(this));
518518

519-
return enabledFeatures.sort();
519+
return enabledFeatures;
520520
};
521521

522522
/**

packages/optimizely-sdk/lib/optimizely/index.tests.js

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2837,35 +2837,6 @@ describe('lib/optimizely', function() {
28372837
attributes
28382838
);
28392839
});
2840-
2841-
it('returns sorted feature-key list', function() {
2842-
var sortedFeatures = [
2843-
'feature_with_group',
2844-
'shared_feature',
2845-
'test_feature',
2846-
'test_feature_2',
2847-
'test_feature_for_experiment',
2848-
'unused_flag'
2849-
];
2850-
2851-
sandbox.restore();
2852-
sandbox.stub(optlyInstance, 'isFeatureEnabled', function(featureKey) {
2853-
return sortedFeatures.indexOf(featureKey) !== -1;
2854-
});
2855-
var attributes = { test_attribute: 'test_value' };
2856-
var result = optlyInstance.getEnabledFeatures('user1', attributes);
2857-
assert.deepEqual(sortedFeatures, result);
2858-
sinon.assert.callCount(optlyInstance.isFeatureEnabled, 6);
2859-
2860-
sinon.assert.callOrder(
2861-
optlyInstance.isFeatureEnabled.withArgs('test_feature', 'user1', attributes),
2862-
optlyInstance.isFeatureEnabled.withArgs('test_feature_2', 'user1', attributes),
2863-
optlyInstance.isFeatureEnabled.withArgs('test_feature_for_experiment', 'user1', attributes),
2864-
optlyInstance.isFeatureEnabled.withArgs('feature_with_group', 'user1', attributes),
2865-
optlyInstance.isFeatureEnabled.withArgs('shared_feature', 'user1', attributes),
2866-
optlyInstance.isFeatureEnabled.withArgs('unused_flag', 'user1', attributes)
2867-
);
2868-
});
28692840
});
28702841

28712842
describe('feature variable APIs', function() {

0 commit comments

Comments
 (0)