Skip to content

Commit 8fc2778

Browse files
committed
add tests with test nupkg files
1 parent ac8d77a commit 8fc2778

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

test/PublishPSResourceTests/PublishPSResourceContainerRegistryServer.Tests.ps1

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ Describe "Test Publish-PSResource" -tags 'CI' {
9797

9898
# Path to specifically to that invalid test scripts folder
9999
$script:testScriptsFolderPath = Join-Path $script:testFilesFolderPath -ChildPath "testScripts"
100+
101+
# Path to specifically to that invalid test nupkgs folder
102+
$script:testNupkgsFolderPath = Join-Path $script:testFilesFolderPath -ChildPath "testNupkgs"
100103
}
101104
AfterEach {
102105
if(!(Test-Path $script:PublishModuleBase))
@@ -511,6 +514,42 @@ Describe "Test Publish-PSResource" -tags 'CI' {
511514
$results[0].Name | Should -Be $script:PublishModuleName
512515
$results[0].Version | Should -Be $version
513516
}
517+
518+
It "Publish a package given NupkgPath to a package with .psd1" {
519+
$packageName = "temp-testmodule-nupkgpath"
520+
$version = "1.0.0.0"
521+
$nupkgPath = Join-Path -Path $script:testNupkgsFolderPath -ChildPath $packageName
522+
Publish-PSResource -NupkgPath $nupkgPath -Repository $ACRRepoName
523+
524+
$results = Find-PSResource -Name $packageName -Repository $ACRRepoName
525+
$results | Should -Not -BeNullOrEmpty
526+
$results[0].Name | Should -Be $packageName
527+
$results[0].Version | Should -Be $version
528+
}
529+
530+
It "Publish a package given NupkgPath to a package with .ps1" {
531+
$packageName = "temp-testscript-nupkgpath"
532+
$version = "1.0.0.0"
533+
$nupkgPath = Join-Path -Path $script:testNupkgsFolderPath -ChildPath $packageName
534+
Publish-PSResource -NupkgPath $nupkgPath -Repository $ACRRepoName
535+
536+
$results = Find-PSResource -Name $packageName -Repository $ACRRepoName
537+
$results | Should -Not -BeNullOrEmpty
538+
$results[0].Name | Should -Be $packageName
539+
$results[0].Version | Should -Be $version
540+
}
541+
542+
It "Publish a package given NupkgPath to a package with .nuspec" {
543+
$packageName = "temp-testnupkg-nupkgpath"
544+
$version = "1.0.0.0"
545+
$nupkgPath = Join-Path -Path $script:testNupkgsFolderPath -ChildPath $packageName
546+
Publish-PSResource -NupkgPath $nupkgPath -Repository $ACRRepoName
547+
548+
$results = Find-PSResource -Name $packageName -Repository $ACRRepoName
549+
$results | Should -Not -BeNullOrEmpty
550+
$results[0].Name | Should -Be $packageName
551+
$results[0].Version | Should -Be $version
552+
}
514553
}
515554

516555
Describe 'Test Publish-PSResource for MAR Repository' -tags 'CI' {
3.31 KB
Binary file not shown.
Binary file not shown.
2.16 KB
Binary file not shown.

0 commit comments

Comments
 (0)