Skip to content

Commit 5028fd7

Browse files
committed
add test
1 parent 3b425e3 commit 5028fd7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
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

0 commit comments

Comments
 (0)