@@ -125,7 +125,7 @@ Describe 'Test HTTP Save-PSResource for V2 Server Protocol' -tags 'CI' {
125125 $pkgDirVersion.Name | Should - Be " 5.2.5"
126126 }
127127
128- It " Save a module with a dependency" {
128+ It " Save a module with a dependency" {
129129 Save-PSResource - Name " TestModuleWithDependencyE" - Version " 1.0.0.0" - Repository $PSGalleryName - Path $SaveDir - TrustRepository
130130 $pkgDirs = Get-ChildItem - Path $SaveDir | Where-Object { $_.Name -eq " TestModuleWithDependencyE" -or $_.Name -eq " TestModuleWithDependencyC" -or $_.Name -eq " TestModuleWithDependencyB" -or $_.Name -eq " TestModuleWithDependencyD" }
131131 $pkgDirs.Count | Should - BeGreaterThan 1
@@ -148,7 +148,7 @@ Describe 'Test HTTP Save-PSResource for V2 Server Protocol' -tags 'CI' {
148148 Find-PSResource - Name $testModuleName - Version " 5.2.5-alpha001" - Repository $PSGalleryName | Save-PSResource - Path $SaveDir - TrustRepository - Verbose
149149 $pkgDir = Get-ChildItem - Path $SaveDir | Where-Object Name -eq $testModuleName
150150 $pkgDir | Should -Not - BeNullOrEmpty
151- (Get-ChildItem - Path $pkgDir.FullName ) | Should - HaveCount 1
151+ (Get-ChildItem - Path $pkgDir.FullName ) | Should - HaveCount 1
152152 }
153153
154154 It " Save module as a nupkg" {
@@ -173,10 +173,17 @@ Describe 'Test HTTP Save-PSResource for V2 Server Protocol' -tags 'CI' {
173173 $res.Version | Should - Be " 1.0.0.0"
174174 }
175175
176+ It " Save script without using -IncludeXML" {
177+ Save-PSResource - Name $testScriptName - Repository $PSGalleryName - Path $SaveDir - TrustRepository | Should -Not - Throw
178+
179+ $SavedScriptFile = Join-Path - Path $SaveDir - ChildPath " $testScriptName .ps1"
180+ Test-Path - Path $SavedScriptFile - PathType ' Leaf' | Should - BeTrue
181+ }
182+
176183 It " Save script using -IncludeXML" {
177- Save-PSResource - Name $testScriptName - Repository $PSGalleryName - Path $SaveDir - TrustRepository
184+ Save-PSResource - Name $testScriptName - Repository $PSGalleryName - Path $SaveDir - TrustRepository - IncludeXml
178185
179- $scriptXML = $testScriptNamen + " _InstalledScriptInfo.xml"
186+ $scriptXML = $testScriptName + " _InstalledScriptInfo.xml"
180187 $savedScriptFile = Get-ChildItem - Path $SaveDir | Where-Object Name -eq " test_script.ps1"
181188 $savedScriptXML = Get-ChildItem - Path $SaveDir | Where-Object Name -eq $scriptXML
182189 $savedScriptFile | Should -Not - BeNullOrEmpty
@@ -192,4 +199,4 @@ Describe 'Test HTTP Save-PSResource for V2 Server Protocol' -tags 'CI' {
192199 $err.Count | Should - BeGreaterThan 0
193200 $err [0 ].FullyQualifiedErrorId | Should - BeExactly " InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.SavePSResource"
194201 }
195- }
202+ }
0 commit comments