@@ -388,3 +388,43 @@ func TestAddOnUnsupportedKey(t *testing.T) {
388
388
require .NoError (t , err )
389
389
requirejson .Query (t , stdout , ".daemon | .port" , "\" 50051\" " )
390
390
}
391
+
392
+ func TestRemoveSingleArgument (t * testing.T ) {
393
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
394
+ defer env .CleanUp ()
395
+
396
+ // Create a config file
397
+ _ , _ , err := cli .Run ("config" , "init" , "--dest-dir" , "." )
398
+ require .NoError (t , err )
399
+
400
+ // Adds URLs
401
+ urls := [2 ]string {
402
+ "https://example.com/package_example_index.json" ,
403
+ "https://example.com/yet_another_package_example_index.json" ,
404
+ }
405
+ _ , _ , err = cli .Run ("config" , "add" , "board_manager.additional_urls" , urls [0 ], urls [1 ])
406
+ require .NoError (t , err )
407
+
408
+ // Verifies default state
409
+ stdout , _ , err := cli .Run ("config" , "dump" , "--format" , "json" )
410
+ require .NoError (t , err )
411
+ requirejson .Query (t , stdout , ".board_manager | .additional_urls | length" , "2" )
412
+ requirejson .Contains (t , stdout , `
413
+ {
414
+ "board_manager": {
415
+ "additional_urls": [
416
+ "https://example.com/package_example_index.json",
417
+ "https://example.com/yet_another_package_example_index.json"
418
+ ]
419
+ }
420
+ }` )
421
+
422
+ // Remove first URL
423
+ _ , _ , err = cli .Run ("config" , "remove" , "board_manager.additional_urls" , urls [0 ])
424
+ require .NoError (t , err )
425
+
426
+ // Verifies URLs has been removed
427
+ stdout , _ , err = cli .Run ("config" , "dump" , "--format" , "json" )
428
+ require .NoError (t , err )
429
+ requirejson .Query (t , stdout , ".board_manager | .additional_urls" , "[\" https://example.com/yet_another_package_example_index.json\" ]" )
430
+ }
0 commit comments