Browse Source

Add test for bad input

Christopher Mullins 6 years ago
parent
commit
0f9204a5e5
1 changed files with 18 additions and 0 deletions
  1. 18 0
      test/remote/spec/rest_spec.rb

+ 18 - 0
test/remote/spec/rest_spec.rb

@@ -154,5 +154,23 @@ RSpec.describe 'REST Server' do
       expect(state['status']).to eq('ON')
       expect(state['hue']).to eq(100)
     end
+
+    it 'should handle saving bad input gracefully' do
+      values_to_try = [
+        'string',
+        123,
+        [ ],
+        { 'test' => [ 'rgb_cct' ] },
+        { 'test' => [ 'rgb_cct', 1 ] },
+        { 'test' => [ 'rgb_cct', '1', 2 ] },
+        { 'test' => [ 'abc' ] }
+      ]
+
+      values_to_try.each do |v|
+        expect {
+          @client.patch_settings(group_id_aliases: v)
+        }.to_not raise_error
+      end
+    end
   end
 end