Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Commit be7dbcf

Browse files
committed
Style changes
2 parents a00c99d + 98bdd81 commit be7dbcf

File tree

13 files changed

+54
-58
lines changed

13 files changed

+54
-58
lines changed

OperationValidation/Diagnostics/Comprehensive/PSGallery.Comprehensive.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Describe 'E2E validation of PSGallery' -Fixture {
3131
}
3232

3333
AfterAll {
34-
if ( $PSDefaultParameterValues['It:skip'] -ne $true) {
34+
if ($PSDefaultParameterValues['It:skip'] -ne $true) {
3535
Uninstall-Module -Force -RequiredVersion $version -Name $ModuleName -ErrorAction SilentlyContinue
3636
}
3737
}

OperationValidation/OperationValidation.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
$script:pathSeparator = [IO.Path]::PathSeparator
33

44
# Dot source public/private functions
5-
$public = @( Get-ChildItem -Path $PSScriptRoot\Public\*.ps1 -Recurse -ErrorAction SilentlyContinue )
6-
$private = @( Get-ChildItem -Path $PSScriptRoot\Private\*.ps1 -Recurse -ErrorAction SilentlyContinue )
5+
$public = @( Get-ChildItem -Path ([IO.Path]::Combine($PSScriptRoot, 'Public', '*.ps1')) -Recurse -ErrorAction SilentlyContinue )
6+
$private = @( Get-ChildItem -Path ([IO.Path]::Combine($PSScriptRoot, 'Private', '*.ps1')) -Recurse -ErrorAction SilentlyContinue )
77
foreach($import in @($public + $private)) {
88
try {
99
. $import.FullName

OperationValidation/Private/Convert-TestResult.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ Function Convert-TestResult {
88
[string]$ModuleName
99
)
1010

11-
foreach ( $testResult in $result.TestResult ) {
11+
foreach ($testResult in $result.TestResult) {
1212
$testError = $null
13-
if ( $testResult.Result -eq 'Failed' ) {
13+
if ($testResult.Result -eq 'Failed') {
1414
Write-Verbose -message 'Creating error object'
1515
$testError = New-OperationValidationFailure -Stacktrace $testResult.StackTrace -FailureMessage $testResult.FailureMessage
1616
}

OperationValidation/Private/Get-ModuleList.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ function Get-ModuleList {
3131
$Name = $modDir.Name
3232
}
3333

34-
foreach ($n in $Name ) {
35-
if ( $modDir.Name -like $n ) {
34+
foreach ($n in $Name) {
35+
if ($modDir.Name -like $n) {
3636
# now determine if there's a diagnostics directory, or a version
37-
if ( Test-Path -Path (Join-Path -Path $modDir.FullName -ChildPath 'Diagnostics')) {
37+
if (Test-Path -Path (Join-Path -Path $modDir.FullName -ChildPath 'Diagnostics')) {
3838
# Did we specify a specific version to find?
3939
if ($PSBoundParameters.ContainsKey('Version')) {
4040
$manifestFile = Get-ChildItem -Path $modDir.FullName -Filter "$($modDir.Name).psd1" | Select-Object -First 1
@@ -68,7 +68,7 @@ function Get-ModuleList {
6868
$DiagnosticDir = $potentialDiagnostics |
6969
Sort-Object {$_.name -as [version]} |
7070
Select-Object -Last 1
71-
if ( $DiagnosticDir ) {
71+
if ($DiagnosticDir) {
7272
$DiagnosticDir.FullName
7373
break
7474
}

OperationValidation/Public/Get-OperationValidation.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ function Get-OperationValidation {
229229
$manifest = $null
230230
}
231231

232-
if ( test-path -path $diagnosticsDir ) {
232+
if (Test-Path -Path $diagnosticsDir) {
233233
foreach($dir in $testType) {
234234
$testDir = Join-Path -Path $diagnosticsDir -ChildPath $dir
235235
if (-not (Test-Path -Path $testDir)) {

OperationValidation/Public/Invoke-OperationValidation.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ function Invoke-OperationValidation {
175175

176176
begin {
177177
$pesterMod = Get-Module -Name Pester
178-
if ( -not $pesterMod) {
179-
if ( Get-Module -Name Pester -ListAvailable) {
178+
if (-not $pesterMod) {
179+
if (Get-Module -Name Pester -ListAvailable) {
180180
$pesterMod = Import-Module -Name Pester -Verbose:$false -PassThru
181181
} else {
182182
Throw "Cannot load Pester module"
@@ -193,7 +193,7 @@ function Invoke-OperationValidation {
193193
}
194194

195195
process {
196-
if ( $PSCmdlet.ParameterSetName -in $resolveOvfTestParameterSetNames ) {
196+
if ($PSCmdlet.ParameterSetName -in $resolveOvfTestParameterSetNames) {
197197
$getOvfParams = @{
198198
TestType = $TestType
199199
}
@@ -218,7 +218,7 @@ function Invoke-OperationValidation {
218218
$testInfo = Get-OperationValidation @getOvfParams
219219
}
220220

221-
if ( $testInfo ) {
221+
if ($testInfo) {
222222
# first check to be sure all of the TestInfos are sane
223223
foreach($ti in $testinfo) {
224224
if (-not ($ti.FilePath -and $ti.Name)) {
@@ -276,7 +276,7 @@ function Invoke-OperationValidation {
276276
$pesterParams.ExcludeTag = $ExcludeTag
277277
}
278278

279-
if ( $PSCmdlet.ShouldProcess("$($ti.Name) [$($ti.FilePath)]")) {
279+
if ($PSCmdlet.ShouldProcess("$($ti.Name) [$($ti.FilePath)]")) {
280280
$testResult = Invoke-Pester @pesterParams
281281
if ($testResult) {
282282
Add-member -InputObject $testResult -MemberType NoteProperty -Name Path -Value $ti.FilePath
@@ -306,7 +306,7 @@ function Invoke-OperationValidation {
306306

307307
foreach($filePath in $TestFilePath) {
308308
write-progress -Activity "Invoking tests in $filePath"
309-
if ( $PSCmdlet.ShouldProcess($filePath)) {
309+
if ($PSCmdlet.ShouldProcess($filePath)) {
310310
$testResult = Invoke-Pester $filePath @pesterParams
311311
Add-Member -InputObject $testResult -MemberType NoteProperty -Name Path -Value $filePath
312312
Convert-TestResult -Result $testResult
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
Describe "Windows Search finds the proper application" {
2-
It "Finds notepad" {
3-
$con = new-object -com ADODB.Connection
4-
$rs = new-object -com ADODB.RecordSet
1+
Describe 'Windows Search finds the proper application' {
2+
It 'Finds notepad' {
3+
$con = New-Object -com ADODB.Connection
4+
$rs = New-Object -com ADODB.RecordSet
55
$con.Open("Provider=Search.CollatorDSO;Extended properties='Application=Windows';")
6-
$rs.Open("Select System.ItemPathDisplay FROM SYSTEMINDEX Where System.FileName = 'notepad.exe'",$con)
6+
$rs.Open("Select System.ItemPathDisplay FROM SYSTEMINDEX Where System.FileName = 'notepad.exe'", $con)
77
$rs.MoveFirst()
88
$notepads = @()
9-
While(! $rs.EOF ){
9+
while (-not $rs.EOF) {
1010
$notepads += $rs.Fields['System.ItemPathDisplay'].Value
1111
$rs.MoveNext()
1212
}
1313
$rs.Close()
1414
$con.Close()
15-
$notepadPath = "C:\Windows\System32\notepad.exe"
15+
$notepadPath = 'C:\Windows\System32\notepad.exe'
1616
$notepads -eq $notepadpath | Should be $notepadpath
17-
1817
}
1918
}

Tests/Meta/Help.tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ $testModuleDir = (Resolve-Path -Path (Join-Path -Path $env:BHProjectPath -ChildP
88
# Remove all versions of the module from the session. Pester can't handle multiple versions.
99
$pathSeparator = [IO.Path]::PathSeparator
1010
$savedModulePath = $env:PSModulePath
11-
if ( $env:PSModulePath.split($pathSeparator) -notcontains $testModuleDir ) {
11+
if ($env:PSModulePath.split($pathSeparator) -notcontains $testModuleDir) {
1212
$env:PSModulePath += ($pathSeparator + $testModuleDir)
1313
}
1414
if ($env:PSModulePath.Split($pathSeparator) -notcontains $env:BHModulePath) {

Tests/Meta/Manifest.tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Describe 'Module manifest' {
5555
}
5656

5757
It "changelog and manifest versions are the same" {
58-
$script:changelogVersion -as [Version] | Should be ( $script:manifest.Version -as [Version] )
58+
$script:changelogVersion -as [Version] | Should be ($script:manifest.Version -as [Version])
5959
}
6060

6161
if (Get-Command -Name 'git.exe' -ErrorAction SilentlyContinue) {
@@ -72,7 +72,7 @@ Describe 'Module manifest' {
7272
}
7373

7474
It "all versions are the same" {
75-
$script:changelogVersion -as [Version] | Should be ( $script:manifest.Version -as [Version] )
75+
$script:changelogVersion -as [Version] | Should be ($script:manifest.Version -as [Version])
7676
}
7777
}
7878
}

Tests/OperationValidation.Tests.ps1

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

22
$testModuleDir = (Resolve-Path -Path (Join-Path -Path $env:BHProjectPath -ChildPath TestArtifacts)).Path
33

4-
Describe "OperationValidation Module Tests" {
4+
Describe 'OperationValidation Module Tests' {
55

66
BeforeAll {
77
$pathSeparator = [IO.Path]::PathSeparator
88
$SavedModulePath = $env:PSModulePath
9-
if ( $env:PSModulePath.split($pathSeparator) -notcontains $testModuleDir ) {
9+
if ($env:PSModulePath.split($pathSeparator) -notcontains $testModuleDir) {
1010
$env:PSModulePath += ($pathSeparator + $testModuleDir)
1111
}
1212
if ($env:PSModulePath.Split($pathSeparator) -notcontains $env:BHModulePath) {
@@ -22,63 +22,60 @@ Describe "OperationValidation Module Tests" {
2222
Remove-Module OperationValidation
2323
}
2424

25-
Context "Get-OperationValidation parameters" {
26-
It "ModuleName parameter is proper type" {
25+
Context 'Get-OperationValidation parameters' {
26+
It 'ModuleName parameter is proper type' {
2727
$commands[0].Parameters['Name'].ParameterType | Should be ([System.String[]])
2828
}
29-
It "Version parameter is proper type" {
29+
It 'Version parameter is proper type' {
3030
$commands[0].Parameters['Version'].ParameterType | Should be ([System.Version])
3131
}
32-
It "TestType parameter is proper type" {
32+
It 'TestType parameter is proper type' {
3333
$commands[0].Parameters['TestType'].ParameterType | Should be ([System.String[]])
3434
}
35-
It "Tag parameter is property type" {
35+
It 'Tag parameter is property type' {
3636
$commands[0].Parameters['Tag'].ParameterType | Should be ([System.String[]])
3737
}
38-
It "ExcludeTag parameter is property type" {
38+
It 'ExcludeTag parameter is property type' {
3939
$commands[0].Parameters['Tag'].ParameterType | Should be ([System.String[]])
4040
}
41-
It "TestType parameter has proper constraints" {
41+
It 'TestType parameter has proper constraints' {
4242
$Commands[0].Parameters['TestType'].Attributes.ValidValues.Count | should be 2
43-
$Commands[0].Parameters['TestType'].Attributes.ValidValues -eq "Simple" | Should be "Simple"
44-
$Commands[0].Parameters['TestType'].Attributes.ValidValues -eq "Comprehensive" | Should be "Comprehensive"
43+
$Commands[0].Parameters['TestType'].Attributes.ValidValues -eq 'Simple' | Should be 'Simple'
44+
$Commands[0].Parameters['TestType'].Attributes.ValidValues -eq 'Comprehensive' | Should be 'Comprehensive'
4545
}
4646
}
47-
Context "Invoke-OperationValidation parameters" {
48-
It "TestFilePath parameter is proper type" {
47+
Context 'Invoke-OperationValidation parameters' {
48+
It 'TestFilePath parameter is proper type' {
4949
$commands[1].Parameters['TestFilePath'].ParameterType | Should be ([System.String[]])
5050
}
51-
It "TestInfo parameter is proper type" {
51+
It 'TestInfo parameter is proper type' {
5252
$commands[1].Parameters['TestInfo'].ParameterType | Should be ([System.Management.Automation.PSObject[]])
5353
}
54-
It "ModuleName parameter is proper type" {
54+
It 'ModuleName parameter is proper type' {
5555
$commands[1].Parameters['ModuleName'].ParameterType | Should be ([System.String[]])
5656
}
57-
It "Version parameter is proper type" {
57+
It 'Version parameter is proper type' {
5858
$commands[1].Parameters['Version'].ParameterType | Should be ([System.Version])
5959
}
60-
It "Overrides parameter is proper type" {
60+
It 'Overrides parameter is proper type' {
6161
$commands[1].Parameters['Overrides'].ParameterType | Should be ([System.Collections.Hashtable])
6262
}
63-
It "IncludePesterOutput is proper type" {
63+
It 'IncludePesterOutput is proper type' {
6464
$commands[1].Parameters['IncludePesterOutput'].ParameterType | Should be ([System.Management.Automation.SwitchParameter])
6565
}
66-
It "TestType parameter is proper type" {
66+
It 'TestType parameter is proper type' {
6767
$commands[1].Parameters['TestType'].ParameterType | Should be ([System.String[]])
6868
}
69-
It "Tag parameter is proper type" {
69+
It 'Tag parameter is proper type' {
7070
$commands[1].Parameters['Tag'].ParameterType | Should be ([System.String[]])
7171
}
72-
It "ExcludeTag parameter is proper type" {
72+
It 'ExcludeTag parameter is proper type' {
7373
$commands[1].Parameters['ExcludeTag'].ParameterType | Should be ([System.String[]])
7474
}
75-
It "TestType parameter has proper constraints" {
75+
It 'TestType parameter has proper constraints' {
7676
$Commands[1].Parameters['TestType'].Attributes.ValidValues.Count | should be 2
77-
$Commands[1].Parameters['TestType'].Attributes.ValidValues -eq "Simple" | Should be "Simple"
78-
$Commands[1].Parameters['TestType'].Attributes.ValidValues -eq "Comprehensive" | Should be "Comprehensive"
77+
$Commands[1].Parameters['TestType'].Attributes.ValidValues -eq 'Simple' | Should be 'Simple'
78+
$Commands[1].Parameters['TestType'].Attributes.ValidValues -eq 'Comprehensive' | Should be 'Comprehensive'
7979
}
8080
}
81-
82-
83-
8481
}

0 commit comments

Comments
 (0)