Skip to content

Commit 1d62d32

Browse files
committed
Add some tests
1 parent b46c972 commit 1d62d32

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
Describe "Actions from the root of a drive" -Tag Scenario {
2+
BeforeAll {
3+
Initialize-ChocolateyTestInstall
4+
Push-Location '\'
5+
Invoke-Choco new roottest --version 1.0.0
6+
Remove-Item roottest/tools/*.ps1 -ErrorAction SilentlyContinue
7+
Invoke-Choco pack roottest/roottest.nuspec
8+
}
9+
10+
AfterAll {
11+
Remove-ChocolateyTestInstall
12+
Remove-Item roottest, roottest.1.0.0.nupkg -Force -Recurse -ErrorAction SilentlyContinue
13+
Pop-Location
14+
}
15+
16+
Context "Searching with <_> '.' source at the root of a drive" -ForEach @('find', 'search') {
17+
BeforeAll {
18+
$Output = Invoke-Choco $_ --source="'.'"
19+
}
20+
21+
It 'Exits with Success (0)' {
22+
$Output.ExitCode | Should -Be 0 -Because $Output.String
23+
}
24+
25+
It 'Does not output message about being unable to parse a source' {
26+
$Output.Lines | Should -Not -Contain "Source '.' is unable to be parsed" -Because $Output.String
27+
}
28+
29+
It "Finds the package expected" {
30+
$Output.Lines | Should -Contain "roottest 1.0.0" -Because $Output.String
31+
}
32+
}
33+
34+
Context "Installing from '.' source using <_> at the root of a drive" -ForEach @( 'install', 'upgrade' ) {
35+
BeforeAll {
36+
Restore-ChocolateyInstallSnapshot
37+
$Output = Invoke-Choco $_ roottest --source="'.'"
38+
}
39+
40+
AfterAll {
41+
Remove-ChocolateyInstallSnapshot
42+
}
43+
44+
It 'Exits with Success (0)' {
45+
$Output.ExitCode | Should -Be 0 -Because $Output.String
46+
}
47+
48+
It 'Does not output message about being unable to parse a source' {
49+
$Output.Lines | Should -Not -Contain "Source '.' is unable to be parsed" -Because $Output.String
50+
}
51+
52+
It "Finds the package expected" {
53+
$Output.Lines | Should -Contain "roottest v1.0.0" -Because $Output.String
54+
}
55+
56+
It "Successfully updates the package" {
57+
$Output.Lines | Should -Contain "Chocolatey $($_ -replace 'e')ed 1/1 packages." -Because $Output.String
58+
}
59+
}
60+
}

0 commit comments

Comments
 (0)