8000 #6245 refactor all Pester tests to use v4 Should syntax · loanDepot/PowerShell@cf7afac · GitHub
[go: up one dir, main page]

Skip to content

Commit cf7afac

Browse files
PowerShell#6245 refactor all Pester tests to use v4 Should syntax
1 parent e86fea6 commit cf7afac

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1

Lines changed: 22 additions & 22 deletions
}
Original file line numberDiff line numberDiff line change
@@ -123,21 +123,21 @@ Describe "PowerShellGet - Module tests" -tags "Feature" {
123123

124124
It "Should find a module correctly" {
125125
$psgetModuleInfo = Find-Module -Name $ContosoServer -Repository $RepositoryName
126-
$psgetModuleInfo.Name | Should Be $ContosoServer
127-
$psgetModuleInfo.Repository | Should Be $RepositoryName
126+
$psgetModuleInfo.Name | Should -Be $ContosoServer
127+
$psgetModuleInfo.Repository | Should -Be $RepositoryName
128128
}
129129

130130
It "Should install a module correctly to the required location with CurrentUser scope" {
131131
Install-Module -Name $ContosoServer -Repository $RepositoryName -Scope CurrentUser
132132
$installedModuleInfo = Get-InstalledModule -Name $ContosoServer
133133

134-
$installedModuleInfo | Should Not Be $null
135-
$installedModuleInfo.Name | Should Be $ContosoServer
136-
$installedModuleInfo.InstalledLocation.StartsWith($script:MyDocumentsModulesPath, [System.StringComparison]::OrdinalIgnoreCase) | Should Be $true
134+
$installedModuleInfo | Should -Not-BeNullOrEmpty
135+
$installedModuleInfo.Name | Should -Be $ContosoServer
136+
$installedModuleInfo.InstalledLocation.StartsWith($script:MyDocumentsModulesPath, [System.StringComparison]::OrdinalIgnoreCase) | Should -BeTrue
137137

138138
$module = Get-Module $ContosoServer -ListAvailable
139-
$module.Name | Should be $ContosoServer
140-
$module.ModuleBase | Should Be $installedModuleInfo.InstalledLocation
139+
$module.Name | Should -Be $ContosoServer
140+
$module.ModuleBase | Should -Be $installedModuleInfo.InstalledLocation
141141
}
142142

143143
AfterAll {
@@ -163,13 +163,13 @@ Describe "PowerShellGet - Module tests (Admin)" -tags @('Feature', 'RequireAdmin
163163
Install-Module -Name $ContosoServer -Repository $RepositoryName
164164
$installedModuleInfo = Get-InstalledModule -Name $ContosoServer
165165

166-
$installedModuleInfo | Should Not Be $null
167-
$installedModuleInfo.Name | Should Be $ContosoServer
168-
$installedModuleInfo.InstalledLocation.StartsWith($script:programFilesModulesPath, [System.StringComparison]::OrdinalIgnoreCase) | Should Be $true
166+
$installedModuleInfo | Should -Not -BeNullOrEmpty
167+
$installedModuleInfo.Name | Should -Be $ContosoServer
168+
$installedModuleInfo.InstalledLocation.StartsWith($script:programFilesModulesPath, [System.StringComparison]::OrdinalIgnoreCase) | Should -BeTrue
169169

170170
$module = Get-Module $ContosoServer -ListAvailable
171-
$module.Name | Should be $ContosoServer
172-
$module.ModuleBase | Should Be $installedModuleInfo.InstalledLocation
171+
$module.Name | Should -Be $ContosoServer
172+
$module.ModuleBase | Should -Be $installedModuleInfo.InstalledLocation
173173
174174

175175
AfterAll {
@@ -197,17 +197,17 @@ Describe "PowerShellGet - Script tests" -tags "Feature" {
197197

198198
It "Should find a script correctly" {
199199
$psgetScriptInfo = Find-Script -Name $FabrikamServerScript -Repository $RepositoryName
200-
$psgetScriptInfo.Name | Should Be $FabrikamServerScript
201-
$psgetScriptInfo.Repository | Should Be $RepositoryName
200+
$psgetScriptInfo.Name | Should -Be $FabrikamServerScript
201+
$psgetScriptInfo.Repository | Should -Be $RepositoryName
202202
}
203203

204204
It "Should install a script correctly to the required location with CurrentUser scope" {
205205
Install-Script -Name $FabrikamServerScript -Repository $RepositoryName -Scope CurrentUser -NoPathUpdate
206206
$installedScriptInfo = Get-InstalledScript -Name $FabrikamServerScript
207207

208-
$installedScriptInfo | Should Not Be $null
209-
$installedScriptInfo.Name | Should Be $FabrikamServerScript
210-
$installedScriptInfo.InstalledLocation.StartsWith($script:MyDocumentsScriptsPath, [System.StringComparison]::OrdinalIgnoreCase) | Should Be $true
208+
$installedScriptInfo | Should -Not -BeNullOrEmpty
209+
$installedScriptInfo.Name | Should -Be $FabrikamServerScript
210+
$installedScriptInfo.InstalledLocation.StartsWith($script:MyDocumentsScriptsPath, [System.StringComparison]::OrdinalIgnoreCase) | Should -BeTrue
211211
}
212212

213213
AfterAll {
@@ -233,9 +233,9 @@ Describe "PowerShellGet - Script tests (Admin)" -tags @('Feature', 'RequireAdmin
233233
Install-Script -Name $FabrikamServerScript -Repository $RepositoryName -NoPathUpdate
234234
$installedScriptInfo = Get-InstalledScript -Name $FabrikamServerScript
235235

236-
$installedScriptInfo | Should Not Be $null
237-
$installedScriptInfo.Name | Should Be $FabrikamServerScript
238-
$installedScriptInfo.InstalledLocation.StartsWith($script:ProgramFilesScriptsPath, [System.StringComparison]::OrdinalIgnoreCase) | Should Be $true
236+
$installedScriptInfo | Should -Not -BeNullOrEmpty
237+
$installedScriptInfo.Name | Should -Be $FabrikamServerScript
238+
$installedScriptInfo.InstalledLocation.StartsWith($script:ProgramFilesScriptsPath, [System.StringComparison]::OrdinalIgnoreCase) | Should -BeTrue
239239
}
240240

241241
AfterAll {
@@ -269,8 +269,8 @@ Describe 'PowerShellGet Type tests' -tags @('CI') {
269269
$PowerShellGetTypeDetails.GetEnumerator() | ForEach-Object {
270270
$ClassName = $_.Name
271271
$Type = "$PowerShellGetNamespace.$ClassName" -as [Type]
272-
$Type | Select-Object -ExpandProperty Name | Should Be $ClassName
273-
$_.Value | ForEach-Object { $Type.DeclaredMembers.Name -contains $_ | Should Be $true }
272+
$Type | Select-Object -ExpandProperty Name | Should -Be $ClassName
273+
$_.Value | ForEach-Object { $Type.DeclaredMembers.Name -contains $_ | Should -BeTrue }
274274
}
275275
}
276276
}

0 commit comments

Comments
 (0)
0