-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathpuppet-agent-installer.tests.ps1
50 lines (38 loc) · 1.94 KB
/
puppet-agent-installer.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Describe 'Running PSAnalyser scripts' {
Context 'Validating puppet-agent-installer.ps1' {
BeforeAll {
$analysis = Invoke-ScriptAnalyzer -Settings puppet-agent-installer.codeformating.psd1 -Path ./puppet-agent-installer.ps1
}
$TestCases = @()
Get-ScriptAnalyzerRule | Select-Object -Property RuleName | Foreach-object -Process { $TestCases += @{ RuleName = $_.RuleName } }
It -Name "Should pass <RuleName>" -TestCases $TestCases {
param($RuleName)
$analysis | Where-Object RuleName -EQ $RuleName -outvariable failures | Out-Default
$failures.Count | Should -Be 0
}
}
Context 'Validating puppet-agent-installer.codeformating.psd1' {
BeforeAll {
$analysis = Invoke-ScriptAnalyzer -Settings ./puppet-agent-installer.codeformating.psd1 -Path ./puppet-agent-installer.codeformating.psd1
}
$TestCases = @()
Get-ScriptAnalyzerRule | Select-Object -Property RuleName | Foreach-object -Process { $TestCases += @{ RuleName = $_.RuleName } }
It -Name "Should pass <RuleName>" -TestCases $TestCases {
param($RuleName)
$analysis | Where-Object RuleName -EQ $RuleName -outvariable failures | Out-Default
$failures.Count | Should -Be 0
}
}
Context 'Validating puppet-agent-installer.tests.ps1' {
BeforeAll {
$analysis = Invoke-ScriptAnalyzer -Settings ./puppet-agent-installer.codeformating.psd1 -Path ./puppet-agent-installer.tests.ps1
}
$TestCases = @()
Get-ScriptAnalyzerRule | Select-Object -Property RuleName | Foreach-object -Process { $TestCases += @{ RuleName = $_.RuleName } }
It -Name "Should pass <RuleName>" -TestCases $TestCases {
param($RuleName)
$analysis | Where-Object RuleName -EQ $RuleName -outvariable failures | Out-Default
$failures.Count | Should -Be 0
}
}
}