-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathHelpOut.tests.ps1
More file actions
56 lines (48 loc) · 1.75 KB
/
HelpOut.tests.ps1
File metadata and controls
56 lines (48 loc) · 1.75 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#requires -Module HelpOut
describe HelpOut {
context 'Get-MAML' {
it 'Can get MAML' {
$maml = Get-Command Get-MAML | Get-MAML
$maml = [xml]$maml
$maml.helpItems.command.details.name | Should -be 'Get-MAML'
}
}
context 'Save-MAML' {
it 'Can save all help from a module into MAML' {
$savedMaml = Save-MAML -Module HelpOut -PassThru
[xml][IO.File]::ReadAllText($savedMaml.FullName)
}
}
context 'Install-MAML' {
it 'Can install MAML' {
Install-MAML -Module HelpOut
}
}
context 'Get-ScriptReference' {
it 'Can discover references in a script' {
Get-Command Save-MAML | Get-ScriptReference
}
}
context 'Measure-Help' {
it 'Can measure documentation within a script' {
Get-Command Save-MAML | Measure-Help | Select-Object -ExpandProperty CommentPercent | Should -BeGreaterThan 20
}
}
context 'Get-ScriptStory' {
it 'Can get a markdown narrative from a script' {
Get-Command Get-ScriptStory | Get-ScriptStory | Should -belike '*##*On Each Input*'
}
}
context 'Get-MarkdownHelp' {
it 'Can Get Markdown Help for a command' {
$markdownHelp = "$(Get-MarkdownHelp -Name Get-MarkdownHelp | Out-String -Width 1mb)"
$markdownHelp | Should -Match "-{0,3}[\s\r\n]{0,}Get-MarkdownHelp[\s\n\r]{0,}[\-=]+"
}
}
context 'Save-MarkdownHelp' {
it 'Can Save Markdown help for a whole module' {
$savedMarkdown = Save-MarkdownHelp -PassThru -Module HelpOut
$savedMarkdown | Select-Object -ExpandProperty FullName | Should -BeLike *HelpOut*docs*
}
}
}