Skip to content

Commit 7355f6b

Browse files
author
Kapil Borle
committed
Add tests for external rule scriptpath property
1 parent fdb70bd commit 7355f6b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Tests/Engine/CustomizedRule.tests.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,17 @@ Describe "Test importing correct customized rules" {
150150
$customizedRulePath.Count | Should Be 1
151151
}
152152

153+
It "will set ScriptName property to the target file name" {
154+
$violations = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -CustomizedRulePath $directory\samplerule
155+
$violations[0].ScriptName | Should Be 'TestScript.ps1'
156+
}
157+
158+
It "will set ScriptPath property to the target file path" {
159+
$violations = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -CustomizedRulePath $directory\samplerule
160+
$expectedScriptPath = Join-Path $directory 'TestScript.ps1'
161+
$violations[0].ScriptPath | Should Be $expectedScriptPath
162+
}
163+
153164
if (!$testingLibraryUsage)
154165
{
155166
It "will show the custom rule in the results when given a rule folder path with trailing backslash" {

0 commit comments

Comments
 (0)