@@ -25,19 +25,19 @@ Describe "MissingRequiredFieldModuleManifest" {
25
25
$violations.Message | Should Match $missingMessage
26
26
}
27
27
28
- $numExpectedCorrections = 1
29
- It " has $numExpectedCorrections suggested corrections" {
30
- $violations.SuggestedCorrections.Count | Should Be $numExpectedCorrections
31
- }
28
+ $numExpectedCorrections = 1
29
+ It " has $numExpectedCorrections suggested corrections" {
30
+ $violations.SuggestedCorrections.Count | Should Be $numExpectedCorrections
31
+ }
32
32
33
33
34
- It " has the right suggested correction" {
35
- $expectedText = @'
34
+ It " has the right suggested correction" {
35
+ $expectedText = @'
36
36
# Version number of this module.
37
37
ModuleVersion = '1.0.0.0'
38
38
'@
39
- $violations [0 ].SuggestedCorrections[0 ].Text | Should Match $expectedText
40
- Get-ExtentText $violations [0 ].SuggestedCorrections[0 ] $violationFilepath | Should Match " "
39
+ $violations [0 ].SuggestedCorrections[0 ].Text | Should Match $expectedText
40
+ Get-ExtentText $violations [0 ].SuggestedCorrections[0 ] $violationFilepath | Should Match " "
41
41
}
42
42
}
43
43
@@ -52,5 +52,17 @@ ModuleVersion = '1.0.0.0'
52
52
{Invoke-ScriptAnalyzer - Path $noHashtableFilepath - IncludeRule $missingMemberRuleName } | Should Not Throw
53
53
}
54
54
}
55
+
56
+ Context " Validate the contents of a .psd1 file" {
57
+ It " detects a valid module manifest file" {
58
+ $filepath = Join-Path $directory " TestManifest/ManifestGood.psd1"
59
+ [Microsoft.Windows.PowerShell.ScriptAnalyzer.Helper ]::IsModuleManifest($filepath ) | Should Be $true
60
+ }
61
+
62
+ It " detects a .psd1 file which is not module manifest" {
63
+ $filepath = Join-Path $directory " TestManifest/PowerShellDataFile.psd1"
64
+ [Microsoft.Windows.PowerShell.ScriptAnalyzer.Helper ]::IsModuleManifest($filepath ) | Should Be $false
65
+ }
66
+ }
55
67
}
56
68
0 commit comments