@@ -125,7 +125,7 @@ Describe 'Test HTTP Save-PSResource for V2 Server Protocol' -tags 'CI' {
125
125
$pkgDirVersion.Name | Should - Be " 5.2.5"
126
126
}
127
127
128
- It " Save a module with a dependency" {
128
+ It " Save a module with a dependency" {
129
129
Save-PSResource - Name " TestModuleWithDependencyE" - Version " 1.0.0.0" - Repository $PSGalleryName - Path $SaveDir - TrustRepository
130
130
$pkgDirs = Get-ChildItem - Path $SaveDir | Where-Object { $_.Name -eq " TestModuleWithDependencyE" -or $_.Name -eq " TestModuleWithDependencyC" -or $_.Name -eq " TestModuleWithDependencyB" -or $_.Name -eq " TestModuleWithDependencyD" }
131
131
$pkgDirs.Count | Should - BeGreaterThan 1
@@ -148,7 +148,7 @@ Describe 'Test HTTP Save-PSResource for V2 Server Protocol' -tags 'CI' {
148
148
Find-PSResource - Name $testModuleName - Version " 5.2.5-alpha001" - Repository $PSGalleryName | Save-PSResource - Path $SaveDir - TrustRepository - Verbose
149
149
$pkgDir = Get-ChildItem - Path $SaveDir | Where-Object Name -eq $testModuleName
150
150
$pkgDir | Should -Not - BeNullOrEmpty
151
- (Get-ChildItem - Path $pkgDir.FullName ) | Should - HaveCount 1
151
+ (Get-ChildItem - Path $pkgDir.FullName ) | Should - HaveCount 1
152
152
}
153
153
154
154
It " Save module as a nupkg" {
@@ -173,10 +173,17 @@ Describe 'Test HTTP Save-PSResource for V2 Server Protocol' -tags 'CI' {
173
173
$res.Version | Should - Be " 1.0.0.0"
174
174
}
175
175
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
+
176
183
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
178
185
179
- $scriptXML = $testScriptNamen + " _InstalledScriptInfo.xml"
186
+ $scriptXML = $testScriptName + " _InstalledScriptInfo.xml"
180
187
$savedScriptFile = Get-ChildItem - Path $SaveDir | Where-Object Name -eq " test_script.ps1"
181
188
$savedScriptXML = Get-ChildItem - Path $SaveDir | Where-Object Name -eq $scriptXML
182
189
$savedScriptFile | Should -Not - BeNullOrEmpty
@@ -192,4 +199,4 @@ Describe 'Test HTTP Save-PSResource for V2 Server Protocol' -tags 'CI' {
192
199
$err.Count | Should - BeGreaterThan 0
193
200
$err [0 ].FullyQualifiedErrorId | Should - BeExactly " InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.SavePSResource"
194
201
}
195
- }
202
+ }
0 commit comments