Skip to content

Commit a23b330

Browse files
authored
Merge pull request #32 from alerickson/forceParams
2 parents 8be852f + 5028fd7 commit a23b330

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Test/UpdatePSResource.Tests.ps1

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,24 @@ Describe 'Test CompatPowerShellGet: Update-PSResource' -tags 'CI' {
347347
$res.Name | Should -Contain $testModuleName
348348
$res.Version | Should -Contain "3.0.0.0"
349349
}
350+
351+
It "Update resource installed given -Name and -Force parameters" {
352+
Install-PSResource -Name $testModuleName -Version "1.0.0.0" -Repository $PSGalleryName -TrustRepository
353+
354+
Update-Module -Name $testModuleName -RequiredVersion "3.0.0.0" -Foce
355+
$res = Get-InstalledPSResource -Name $testModuleName
356+
357+
$isPkgUpdated = $false
358+
foreach ($pkg in $res)
359+
{
360+
if ([System.Version]$pkg.Version -gt [System.Version]"1.0.0.0")
361+
{
362+
$isPkgUpdated = $true
363+
}
364+
}
365+
366+
$isPkgUpdated | Should -Be $true
367+
}
350368
}
351369

352370
# Ensure that PSGet v2 was not loaded during the test via command discovery

src/CompatPowerShellGet.psm1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2409,7 +2409,6 @@ param(
24092409
# Parameter Deletions (unsupported in v3)
24102410
if ( $PSBoundParameters['Proxy'] ) { $null = $PSBoundParameters.Remove('Proxy') }
24112411
if ( $PSBoundParameters['ProxyCredential'] ) { $null = $PSBoundParameters.Remove('ProxyCredential') }
2412-
if ( $PSBoundParameters['Force'] ) { $null = $PSBoundParameters.Remove('Force') }
24132412
# END PARAMETER MAP
24142413

24152414
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Update-PSResource', [System.Management.Automation.CommandTypes]::Cmdlet)
@@ -2513,7 +2512,6 @@ param(
25132512
# Parameter Deletions (unsupported in v3)
25142513
if ( $PSBoundParameters['Proxy'] ) { $null = $PSBoundParameters.Remove('Proxy') }
25152514
if ( $PSBoundParameters['ProxyCredential'] ) { $null = $PSBoundParameters.Remove('ProxyCredential') }
2516-
if ( $PSBoundParameters['Force'] ) { $null = $PSBoundParameters.Remove('Force') }
25172515
# END PARAMETER MAP
25182516

25192517
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Update-PSResource', [System.Management.Automation.CommandTypes]::Cmdlet)

0 commit comments

Comments
 (0)