@@ -803,6 +803,31 @@ class InvalidErrorHandler; end
803803 # Checks prevented features should not return
804804 expect ( project_instance . get_enabled_features ( 'test_user' , 'browser_type' => 'chrome' ) ) . not_to include ( *disabled_features )
805805 end
806+
807+ it 'should return sorted feature keys' do
808+ # Mock is_feature_enabled and assert that is_feature_enabled does get called in an unsorted order
809+ expect ( project_instance ) . to receive ( :is_feature_enabled ) . with ( 'boolean_feature' , 'test_user' , 'browser_type' => 'chrome' ) . and_return ( true ) . ordered
810+ expect ( project_instance ) . to receive ( :is_feature_enabled ) . with ( 'double_single_variable_feature' , 'test_user' , 'browser_type' => 'chrome' ) . and_return ( true ) . ordered
811+ expect ( project_instance ) . to receive ( :is_feature_enabled ) . with ( 'integer_single_variable_feature' , 'test_user' , 'browser_type' => 'chrome' ) . and_return ( true ) . ordered
812+ expect ( project_instance ) . to receive ( :is_feature_enabled ) . with ( 'boolean_single_variable_feature' , 'test_user' , 'browser_type' => 'chrome' ) . and_return ( true ) . ordered
813+ expect ( project_instance ) . to receive ( :is_feature_enabled ) . with ( 'string_single_variable_feature' , 'test_user' , 'browser_type' => 'chrome' ) . and_return ( true ) . ordered
814+ expect ( project_instance ) . to receive ( :is_feature_enabled ) . with ( 'multi_variate_feature' , 'test_user' , 'browser_type' => 'chrome' ) . and_return ( true ) . ordered
815+ expect ( project_instance ) . to receive ( :is_feature_enabled ) . with ( 'mutex_group_feature' , 'test_user' , 'browser_type' => 'chrome' ) . and_return ( true ) . ordered
816+ expect ( project_instance ) . to receive ( :is_feature_enabled ) . with ( 'empty_feature' , 'test_user' , 'browser_type' => 'chrome' ) . and_return ( true ) . ordered
817+
818+ expect ( project_instance . get_enabled_features ( 'test_user' , 'browser_type' => 'chrome' ) ) . to eq (
819+ %w[
820+ boolean_feature
821+ boolean_single_variable_feature
822+ double_single_variable_feature
823+ empty_feature
824+ integer_single_variable_feature
825+ multi_variate_feature
826+ mutex_group_feature
827+ string_single_variable_feature
828+ ]
829+ )
830+ end
806831 end
807832
808833 describe '#get_feature_variable_string' do
0 commit comments