@@ -2837,6 +2837,35 @@ describe('lib/optimizely', function() {
2837
2837
attributes
2838
2838
) ;
2839
2839
} ) ;
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
+ } ) ;
2840
2869
} ) ;
2841
2870
2842
2871
describe ( 'feature variable APIs' , function ( ) {
0 commit comments