Skip to content

Commit aef7ded

Browse files
author
Kapil Borle
committed
Add test for case-insensitive whitelist comparison
1 parent b050102 commit aef7ded

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Tests/Rules/AvoidUsingAlias.tests.ps1

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,16 @@ Configuration MyDscConfiguration {
6161
}
6262

6363
Context "Settings file provides whitelist" {
64-
$whiteListTestScriptDef = 'gci; cd;'
64+
BeforeAll {
65+
$whiteListTestScriptDef = 'gci; cd;'
66+
$settings = @{
67+
'Rules' = @{
68+
'PSAvoidUsingCmdletAliases' = @{
69+
'Whitelist' = @('cd')
70+
}
71+
}
72+
}
73+
}
6574

6675
It "honors the whitelist provided as hashtable" {
6776
$settings = @{
@@ -81,5 +90,10 @@ Configuration MyDscConfiguration {
8190
$violations = Invoke-ScriptAnalyzer -ScriptDefinition $whiteListTestScriptDef -Settings $settingsFilePath -IncludeRule $violationName
8291
$violations.Count | Should be 1
8392
}
93+
94+
It "honors the whitelist in a case-insensitive manner" {
95+
$violations = Invoke-ScriptAnalyzer -ScriptDefinition "CD" -Settings $settings -IncludeRule $violationName
96+
$violations.Count | Should Be 0
97+
}
8498
}
8599
}

0 commit comments

Comments
 (0)