-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathHelp.Tests.ps1
More file actions
36 lines (33 loc) · 1.27 KB
/
Help.Tests.ps1
File metadata and controls
36 lines (33 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
$projectRoot = Resolve-Path "$PSScriptRoot\.."
$moduleRoot = Split-Path (Resolve-Path "$projectRoot\*\*.psd1")
$moduleName = Split-Path $moduleRoot -Leaf
Import-Module (Join-Path $moduleRoot "$moduleName.psd1") -force
Describe "Help tests for $moduleName" -Tags Build {
$functions = Get-Command -Module $moduleName -CommandType Function
foreach($Function in $Functions){
$help = Get-Help $Function.name
Context $help.name {
it "Has a HelpUri" {
$Function.HelpUri | Should Not BeNullOrEmpty
}
It "Has related Links" {
$help.relatedLinks.navigationLink.uri.count | Should BeGreaterThan 0
}
it "Has a description" {
$help.description | Should Not BeNullOrEmpty
}
it "Has an example" {
$help.examples | Should Not BeNullOrEmpty
}
foreach($parameter in $help.parameters.parameter)
{
if($parameter -notmatch 'whatif|confirm')
{
it "Has a Parameter description for '$($parameter.name)'" {
$parameter.Description.text | Should Not BeNullOrEmpty
}
}
}
}
}
}