File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,6 @@ function Invoke-Remove {
15
15
$config.jenvs = @ ($config.jenvs | Where-Object { $_.name -ne $name })
16
16
# Remove any jenv local with that name
17
17
$config.locals = @ ($config.locals | Where-Object { $_.name -ne $name })
18
- Write-Host Your JEnv was removed successfully
18
+ Write-Output ' Your JEnv was removed successfully'
19
19
}
20
20
}
Original file line number Diff line number Diff line change @@ -191,10 +191,40 @@ Describe 'JEnv local command' {
191
191
})
192
192
$config.locals | ConvertTo-Json | Should - Be ($template | ConvertTo-Json )
193
193
}
194
+ }
195
+
196
+ Describe ' JEnv remove command' {
197
+
198
+ It " Should remove jenv from jenvs and locals" {
199
+ & $jenv remove fake1 | Should - Be ' Your JEnv was removed successfully'
200
+ $config = Get-Content - Path ($Env: APPDATA + " \JEnv\jenv.config.json" ) - Raw | ConvertFrom-Json
201
+
202
+ $template = @ ()
203
+ $config.locals | ConvertTo-Json | Should - Be ($template | ConvertTo-Json )
204
+
205
+ $template = @ ([PSCustomObject ]@ {
206
+ name = " fake2"
207
+ path = " $ ( $PSScriptRoot ) /Fake-Executables/java/v2"
208
+ })
209
+ $config.jenvs | ConvertTo-Json | Should - Be ($template | ConvertTo-Json )
210
+ }
211
+
212
+ It " Should remove jenv from jenvs" {
213
+ & $jenv remove fake2 | Should - Be ' Your JEnv was removed successfully'
214
+ $config = Get-Content - Path ($Env: APPDATA + " \JEnv\jenv.config.json" ) - Raw | ConvertFrom-Json
215
+
216
+ $template = @ ()
217
+ $config.jenvs | ConvertTo-Json | Should - Be ($template | ConvertTo-Json )
218
+ }
219
+
220
+ It " Should not fail if it does not exist" {
221
+ & $jenv remove fake2 | Should - Be ' Your JEnv was removed successfully'
222
+ }
194
223
195
224
AfterAll {
196
225
Set-Location ((get-item $PSScriptRoot ).parent.fullname + " /tests" )
197
226
}
227
+
198
228
}
199
229
200
230
You can’t perform that action at this time.
0 commit comments