Skip to content

Commit 1748fbd

Browse files
committed
add tests for FindName(), FindVersion(), FindNameGlobbing() scenarios
1 parent 921fa08 commit 1748fbd

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

test/FindPSResourceTests/FindPSResourceV2Server.Tests.ps1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,4 +457,18 @@ Describe 'Test HTTP Find-PSResource for V2 Server Protocol' -tags 'ManualValidat
457457

458458
$duplicatePkgsFound | Should -BeFalse
459459
}
460+
461+
It "find should return an unlisted module when it was requested explicitly by full name and version (i.e no wildcards)" {
462+
# 'test_unlisted' is an unlisted package
463+
$res = Find-PSResource -Name "test_unlisted" -Version "0.0.1" -Repository $PSGalleryName
464+
$res | Should -Not -BeNullOrEmpty
465+
$res.Version | Should -Be "0.0.1"
466+
}
467+
468+
It "find should not return an unlisted module with it was requested with wildcards in the name" {
469+
# 'test_unlisted' is an unlisted package whereas 'test_notunlisted' is listed
470+
$res = Find-PSResource -Name "test_*unlisted" -Repository $PSGalleryName
471+
$res.Count | Should -Be 1
472+
$res[0].Name | Should -Be "test_notunlisted"
473+
}
460474
}

test/InstallPSResourceTests/InstallPSResourceV2Server.Tests.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,16 @@ Describe 'Test Install-PSResource for V2 Server scenarios' -tags 'CI' {
573573
$res | Should -Not -BeNullOrEmpty
574574
$res.Version | Should -Be $version
575575
}
576+
577+
It "Install resource that is unlisted" {
578+
# 'test_unlisted' is an unlisted package
579+
$moduleName = 'test_unlisted'
580+
$version = '0.0.1'
581+
Install-PSResource -Name $moduleName -Repository $PSGalleryName -TrustRepository
582+
$res = Get-InstalledPSResource $moduleName
583+
$res | Should -Not -BeNullOrEmpty
584+
$res.Version | Should -Be $version
585+
}
576586
}
577587

578588
Describe 'Test Install-PSResource for V2 Server scenarios' -tags 'ManualValidationOnly' {

0 commit comments

Comments
 (0)