Skip to content

Commit 5b94fb7

Browse files
author
Kapil Borle
committed
Add tests to manifest related rules
1 parent ab8dd45 commit 5b94fb7

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

Tests/Rules/AvoidUnloadableModuleOrMissingRequiredFieldInManifest.tests.ps1

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,16 @@ ModuleVersion = '1.0.0.0'
8383
$filepath = Join-Path $directory "TestManifest/ManifestGoodPSv3.psd1"
8484
[Microsoft.Windows.PowerShell.ScriptAnalyzer.Helper]::IsModuleManifest($filepath, [version]"3.0") | Should Be $true
8585
}
86+
}
8687

87-
88+
Context "When given a non module manifest file" {
89+
It "does not flag a PowerShell data file" {
90+
Invoke-ScriptAnalyzer `
91+
-Path "$directory/TestManifest/PowerShellDataFile.psd1" `
92+
-IncludeRule "PSMissingModuleManifestField" `
93+
-OutVariable ruleViolation
94+
$ruleViolation.Count | Should Be 0
95+
}
8896
}
8997
}
9098

Tests/Rules/AvoidUsingDeprecatedManifestFields.tests.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,14 @@ Describe "AvoidUsingDeprecatedManifestFields" {
2121
$noViolations.Count | Should Be 0
2222
}
2323
}
24+
25+
Context "When given a non module manifest file" {
26+
It "does not flag a PowerShell data file" {
27+
Invoke-ScriptAnalyzer `
28+
-Path "$directory/TestManifest/PowerShellDataFile.psd1" `
29+
-IncludeRule "PSAvoidUsingDeprecatedManifestFields" `
30+
-OutVariable ruleViolation
31+
$ruleViolation.Count | Should Be 0
32+
}
33+
}
2434
}

Tests/Rules/UseToExportFieldsInManifest.tests.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,16 @@ Describe "UseManifestExportFields" {
9999
$results.Count | Should be 0
100100
}
101101
}
102+
103+
Context "When given a non module manifest file" {
104+
It "does not flag a PowerShell data file" {
105+
Invoke-ScriptAnalyzer `
106+
-Path "$directory/TestManifest/PowerShellDataFile.psd1" `
107+
-IncludeRule "PSUseToExportFieldsInManifest" `
108+
-OutVariable ruleViolation
109+
$ruleViolation.Count | Should Be 0
110+
}
111+
}
102112
}
103113

104114

0 commit comments

Comments
 (0)