mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2026-09-22 21:35:56 +00:00
Merge pull request #475 from rivy/fix-tests
fix/improve Scoop-Alias and Scoop-Core tests
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
. "$psscriptroot\..\libexec\scoop-alias.ps1"
|
||||
. "$psscriptroot\..\libexec\scoop-alias.ps1" | out-null
|
||||
|
||||
reset_aliases
|
||||
|
||||
describe "add_alias" {
|
||||
mock shimdir { "test\fixtures\shim" }
|
||||
mock shimdir { "TestDrive:\shim" }
|
||||
mock set_config { }
|
||||
mock get_config { @{} }
|
||||
|
||||
$shimdir = shimdir
|
||||
mkdir $shimdir
|
||||
|
||||
context "alias doesn't exist" {
|
||||
it "creates a new alias" {
|
||||
@@ -28,18 +30,16 @@ describe "add_alias" {
|
||||
$alias_file | should contain ""
|
||||
}
|
||||
}
|
||||
|
||||
aftereach {
|
||||
rm "test\fixtures\shim\scoop-rm.ps1" -ea ignore
|
||||
}
|
||||
}
|
||||
|
||||
describe "rm_alias" {
|
||||
mock shimdir { "test\fixtures\shim" }
|
||||
$shimdir = shimdir
|
||||
mock shimdir { "TestDrive:\shim" }
|
||||
mock set_config { }
|
||||
mock get_config { @{} }
|
||||
|
||||
$shimdir = shimdir
|
||||
mkdir $shimdir
|
||||
|
||||
context "alias exists" {
|
||||
it "removes an existing alias" {
|
||||
$alias_file = "$shimdir\scoop-rm.ps1"
|
||||
@@ -52,8 +52,4 @@ describe "rm_alias" {
|
||||
$alias_file | should not exist
|
||||
}
|
||||
}
|
||||
|
||||
afterall {
|
||||
rm "test\fixtures\shim\scoop-rm.ps1" -ea ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
. "$psscriptroot\..\lib\install.ps1"
|
||||
. "$psscriptroot\Scoop-TestLib.ps1"
|
||||
|
||||
$repo_dir = (Get-Item $MyInvocation.MyCommand.Path).directory.parent.FullName
|
||||
|
||||
describe "movedir" {
|
||||
$extract_dir = "subdir"
|
||||
$extract_to = $null
|
||||
@@ -59,7 +61,9 @@ describe "unzip_old" {
|
||||
it "unzips file with zero bytes without error" {
|
||||
$to = test-unzip $zerobyte
|
||||
|
||||
$to | should not be $null
|
||||
$to | should exist
|
||||
|
||||
(gci $to).count | should be 0
|
||||
}
|
||||
}
|
||||
@@ -136,7 +140,7 @@ describe "rm_shim" {
|
||||
|
||||
describe "ensure_robocopy_in_path" {
|
||||
$shimdir = shimdir $false
|
||||
mock versiondir { ".\" }
|
||||
mock versiondir { $repo_dir }
|
||||
|
||||
beforeall {
|
||||
reset_aliases
|
||||
|
||||
Reference in New Issue
Block a user