@@ -416,7 +416,6 @@ suite('CommandLineAutoApprover', () => {
416
416
"Remove-Item" : false
417
417
} ) ;
418
418
419
- // Test various case combinations for allowed commands
420
419
ok ( isAutoApproved ( 'Get-ChildItem' ) ) ;
421
420
ok ( isAutoApproved ( 'get-childitem' ) ) ;
422
421
ok ( isAutoApproved ( 'GET-CHILDITEM' ) ) ;
@@ -428,7 +427,6 @@ suite('CommandLineAutoApprover', () => {
428
427
ok ( isAutoApproved ( 'GET-CONTENT file.txt' ) ) ;
429
428
ok ( isAutoApproved ( 'Get-content file.txt' ) ) ;
430
429
431
- // Test various case combinations for denied commands
432
430
ok ( ! isAutoApproved ( 'Remove-Item file.txt' ) ) ;
433
431
ok ( ! isAutoApproved ( 'remove-item file.txt' ) ) ;
434
432
ok ( ! isAutoApproved ( 'REMOVE-ITEM file.txt' ) ) ;
@@ -467,7 +465,6 @@ suite('CommandLineAutoApprover', () => {
467
465
"/Remove-Item|rm/" : false
468
466
} ) ;
469
467
470
- // Test case-insensitive regex matching (should work even without 'i' flag in PowerShell)
471
468
ok ( isAutoApproved ( 'Get-ChildItem' ) ) ;
472
469
ok ( isAutoApproved ( 'get-childitem' ) ) ;
473
470
ok ( isAutoApproved ( 'GET-PROCESS' ) ) ;
@@ -485,29 +482,14 @@ suite('CommandLineAutoApprover', () => {
485
482
"Stop-Process" : false
486
483
} ) ;
487
484
488
- // Test on Windows
489
- os = OperatingSystem . Windows ;
490
- ok ( isAutoApproved ( 'Get-Process' ) ) ;
491
- ok ( isAutoApproved ( 'get-process' ) ) ;
492
- ok ( isAutoApproved ( 'GET-PROCESS' ) ) ;
493
- ok ( ! isAutoApproved ( 'Stop-Process' ) ) ;
494
- ok ( ! isAutoApproved ( 'stop-process' ) ) ;
495
-
496
- // Test on Linux (PowerShell Core)
497
- os = OperatingSystem . Linux ;
498
- ok ( isAutoApproved ( 'Get-Process' ) ) ;
499
- ok ( isAutoApproved ( 'get-process' ) ) ;
500
- ok ( isAutoApproved ( 'GET-PROCESS' ) ) ;
501
- ok ( ! isAutoApproved ( 'Stop-Process' ) ) ;
502
- ok ( ! isAutoApproved ( 'stop-process' ) ) ;
503
-
504
- // Test on macOS (PowerShell Core)
505
- os = OperatingSystem . Macintosh ;
506
- ok ( isAutoApproved ( 'Get-Process' ) ) ;
507
- ok ( isAutoApproved ( 'get-process' ) ) ;
508
- ok ( isAutoApproved ( 'GET-PROCESS' ) ) ;
509
- ok ( ! isAutoApproved ( 'Stop-Process' ) ) ;
510
- ok ( ! isAutoApproved ( 'stop-process' ) ) ;
485
+ for ( const currnetOS of [ OperatingSystem . Windows , OperatingSystem . Linux , OperatingSystem . Macintosh ] ) {
486
+ os = currnetOS ;
487
+ ok ( isAutoApproved ( 'Get-Process' ) , `os=${ os } ` ) ;
488
+ ok ( isAutoApproved ( 'get-process' ) , `os=${ os } ` ) ;
489
+ ok ( isAutoApproved ( 'GET-PROCESS' ) , `os=${ os } ` ) ;
490
+ ok ( ! isAutoApproved ( 'Stop-Process' ) , `os=${ os } ` ) ;
491
+ ok ( ! isAutoApproved ( 'stop-process' ) , `os=${ os } ` ) ;
492
+ }
511
493
} ) ;
512
494
} ) ;
513
495
0 commit comments