diff --git a/tests/AnyPackage.Homebrew.Unit.Tests.ps1 b/tests/AnyPackage.Homebrew.Unit.Tests.ps1 index fc0e33a..a585ba9 100644 --- a/tests/AnyPackage.Homebrew.Unit.Tests.ps1 +++ b/tests/AnyPackage.Homebrew.Unit.Tests.ps1 @@ -37,13 +37,13 @@ Describe 'DSC-compliant package installation and uninstallation' { Find-Package -Name $package -Source $source | Where-Object {$_.Name -contains $package} | Should -Not -BeNullOrEmpty } It 'silently installs the latest version of a package' { - {Install-Package -Name $package -Source $source} | Should -Not -Throw + Install-Package -Name $package -Source $source -PassThru | Where-Object {$_.Name -contains $package} | Should -Not -BeNullOrEmpty } It 'finds the locally installed package just installed' { Get-Package -Name $package | Where-Object {$_.Name -contains $package} | Should -Not -BeNullOrEmpty } It 'silently uninstalls the locally installed package just installed' { - {Uninstall-Package -Name $package} | Should -Not -Throw + Uninstall-Package -Name $package -PassThru | Where-Object {$_.Name -contains $package} | Should -Not -BeNullOrEmpty } } Context 'cask' { @@ -55,13 +55,13 @@ Describe 'DSC-compliant package installation and uninstallation' { Find-Package -Name $package | Where-Object {$_.Name -contains $package} | Should -Not -BeNullOrEmpty } It 'silently installs the latest version of a package' { - {Install-Package -Name $package} | Should -Not -Throw + Install-Package -Name $package -PassThru | Where-Object {$_.Name -contains $package} | Should -Not -BeNullOrEmpty } It 'finds the locally installed package just installed' { Get-Package -Name $package | Where-Object {$_.Name -contains $package} | Should -Not -BeNullOrEmpty } It 'silently uninstalls the locally installed package just installed' { - {Uninstall-Package -Name $package} | Should -Not -Throw + Uninstall-Package -Name $package -PassThru | Where-Object {$_.Name -contains $package} | Should -Not -BeNullOrEmpty } } } @@ -74,10 +74,10 @@ Describe 'pipeline-based package installation and uninstallation' { } It 'searches for and silently installs the latest version of a package' { - {Find-Package -Name $package -Source $source | Install-Package} | Should -Not -Throw + Find-Package -Name $package -Source $source | Install-Package -PassThru | Where-Object {$_.Name -contains $package} | Should -Not -BeNullOrEmpty } It 'finds and silently uninstalls the locally installed package just installed' { - {Get-Package -Name $package | Uninstall-Package} | Should -Not -Throw + Get-Package -Name $package | Uninstall-Package -PassThru | Where-Object {$_.Name -contains $package} | Should -Not -BeNullOrEmpty } } Context 'cask' { @@ -86,10 +86,10 @@ Describe 'pipeline-based package installation and uninstallation' { } It 'searches for and silently installs the latest version of a package' { - {Find-Package -Name $package | Install-Package} | Should -Not -Throw + Find-Package -Name $package | Install-Package -PassThru | Where-Object {$_.Name -contains $package} | Should -Not -BeNullOrEmpty } It 'finds and silently uninstalls the locally installed package just installed' { - {Get-Package -Name $package | Uninstall-Package} | Should -Not -Throw + Get-Package -Name $package | Uninstall-Package -PassThru | Where-Object {$_.Name -contains $package} | Should -Not -BeNullOrEmpty } } } @@ -150,7 +150,7 @@ Describe "multi-source support" { Register-PackageSource -Name $altSourceName -Location $altSourceLocation -Provider $AnyPackageProvider | Where-Object {$_.Name -eq $altSourceName} | Should -Not -BeNullOrEmpty } It 'searches for and installs the latest version of a package from an alternate source' { - Find-Package -Name $package -Source $altSourceName | Install-Package | Where-Object {$_.Name -contains $package} | Should -Not -BeNullOrEmpty + Find-Package -Name $package -Source $altSourceName | Install-Package -PassThru | Where-Object {$_.Name -contains $package} | Should -Not -BeNullOrEmpty } It 'unregisters an alternative package source' { Unregister-PackageSource -Name $altSourceName -Provider $AnyPackageProvider