forked from ScoopInstaller/Scoop
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Scoop-Alias.Tests.ps1
32 lines (26 loc) · 954 Bytes
/
Scoop-Alias.Tests.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
. "$PSScriptRoot\..\lib\Alias.ps1"
Describe 'Add-ScoopAlias' -Tag 'Scoop' {
BeforeAll {
Mock shimdir { "$env:TMP\Scoopshim" }
Mock load_cfg { }
$shimdir = shimdir
New-Item $shimdir -ItemType Directory -Force | Out-Null
}
Context 'alias does not exist' {
It 'creates a new alias' {
$aliasFile = "$shimdir\scoop-cosiTest.ps1"
$aliasFile | Should -Not -Exist
Add-ScoopAlias -Name 'cosiTest' -Command '"hello, world!"'
Invoke-Expression $aliasFile | Should -Be 'hello, world!'
}
}
Context 'invalid alias definition' {
It 'require needed parameters' {
{ Add-ScoopAlias } | Should -Throw
{ Add-ScoopAlias -Name 'cosi' } | Should -Throw
{ Add-ScoopAlias -Name 'cosi' -Command '' } | Should -Throw
}
}
}
# TODO: Remove alias test
# TODO: Proper scoop installation tests without mocks