-
Notifications
You must be signed in to change notification settings - Fork 0
/
publicApi.Tests.ps1
32 lines (31 loc) · 1.03 KB
/
publicApi.Tests.ps1
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
Import-Module StructuredResource -Force
Describe 'Public API' {
$commands = Get-Command -Module StructuredResource
It 'exports some functions...' {
$commands | measure | % Count | Should beGreaterThan 1
}
It '...but not too many' {
$commands | measure | % Count | Should beLessThan 10
}
Context 'help' {
foreach ( $command in $commands )
{
Context $command.Name {
$help = $command | Get-Help
It 'has a synopsis' {
$help.Synopsis | Should not match $command.Name
}
It 'has a description' {
$help.Description | Should not beNullOrEmpty
}
It 'parameter <n> has a description' -TestCases @(
$help.parameters.parameter |
% { @{ n=$_.Name; p=$_ } }
) {
param($n,$p)
$p.Description | Should not beNullOrEmpty
}
}
}
}
}