Skip to content

Commit c1f1c82

Browse files
author
Kapil Borle
committed
Update test for UseCompatibleCmdlets rule
1 parent 326e453 commit c1f1c82

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

Tests/Rules/UseCompatibleCmdlets.tests.ps1

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
Import-Module PSScriptAnalyzer
2-
$ruleName = "UseCompatibleCmdlets"
2+
$ruleName = "PSUseCompatibleCmdlets"
33
$directory = Split-Path $MyInvocation.MyCommand.Path -Parent
44
$ruleTestDirectory = Join-Path $directory 'UseCompatibleCmdlets'
55

6-
76
Describe "UseCompatibleCmdlets" {
87
Context "script has violation" {
98
It "detects violation" {
109
$violationFilePath = Join-Path $ruleTestDirectory 'ScriptWithViolation.ps1'
11-
$settingsFilePath = Join-Path $ruleTestDirectory 'PSScriptAnalyzerSettings.psd1'
12-
$diagnosticRecords = Invoke-ScriptAnalyzer -Path $violationFilePath -IncludeRule $ruleName -Settings
10+
$settingsFilePath = [System.IO.Path]::Combine($ruleTestDirectory, 'PSScriptAnalyzerSettings.psd1');
11+
$diagnosticRecords = Invoke-ScriptAnalyzer -Path $violationFilePath -IncludeRule $ruleName -Settings $settingsFilePath
1312
$diagnosticRecords.Count | Should Be 1
1413
}
1514
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
@{
22
'Rules' = @{
33
'PSUseCompatibleCmdlets' = @{
4-
'mode' = 'offline',
5-
'path' = '.'
6-
'compatibility' = @{'core_6.0.0-alpha_windows'}
4+
'compatibility' = @("core-6.0.0-alpha-windows")
5+
'mode' = "offline"
6+
'uri' = "C:\users\kabawany\Source\Repos\PSScriptAnalyzer\Tests\Rules\UseCompatibleCmdlets"
77
}
88
}
99
}

0 commit comments

Comments
 (0)