|
1 | 1 | Import-Module helpers/common-helpers
|
2 | 2 |
|
3 |
| -Describe "hooks tests" -Tag Chocolatey, Hooks { |
| 3 | +Describe "choco hooks tests" -Tag Chocolatey, HooksFeature { |
4 | 4 | BeforeDiscovery {
|
5 | 5 | $Flags = @(
|
6 |
| - @{ Flag = '' ; RunsHooks = $true ; Command = 'install' } |
7 |
| - @{ Flag = '--skip-powershell' ; RunsHooks = $false ; Command = 'install' } |
8 |
| - @{ Flag = '--skip-hooks' ; RunsHooks = $false ; Command = 'install' } |
| 6 | + @{ Flag = '' ; RunsHooks = $true ; Command = 'install' ; ExitCode = 0 } |
| 7 | + @{ Flag = '--skip-powershell' ; RunsHooks = $false ; Command = 'install' ; ExitCode = 0 } |
| 8 | + @{ Flag = '--skip-hooks' ; RunsHooks = $false ; Command = 'install' ; ExitCode = 0 } |
9 | 9 |
|
10 |
| - @{ Flag = '' ; RunsHooks = $true ; Command = 'uninstall' } |
11 |
| - @{ Flag = '--skip-powershell' ; RunsHooks = $false ; Command = 'uninstall' } |
12 |
| - @{ Flag = '--skip-hooks' ; RunsHooks = $false ; Command = 'uninstall' } |
| 10 | + @{ Flag = '' ; RunsHooks = $true ; Command = 'uninstall' ; ExitCode = 0 } |
| 11 | + @{ Flag = '--skip-powershell' ; RunsHooks = $false ; Command = 'uninstall' ; ExitCode = 0 } |
| 12 | + @{ Flag = '--skip-hooks' ; RunsHooks = $false ; Command = 'uninstall' ; ExitCode = 0 } |
13 | 13 |
|
14 |
| - @{ Flag = '' ; RunsHooks = $true ; Command = 'upgrade' } |
15 |
| - @{ Flag = '--skip-powershell' ; RunsHooks = $false ; Command = 'upgrade' } |
16 |
| - @{ Flag = '--skip-hooks' ; RunsHooks = $false ; Command = 'upgrade' } |
| 14 | + @{ Flag = '' ; RunsHooks = $true ; Command = 'upgrade' ; ExitCode = -1 } |
| 15 | + @{ Flag = '--skip-powershell' ; RunsHooks = $false ; Command = 'upgrade' ; ExitCode = 0 } |
| 16 | + @{ Flag = '--skip-hooks' ; RunsHooks = $false ; Command = 'upgrade' ; ExitCode = -1 } |
17 | 17 |
|
18 | 18 | )
|
19 | 19 | }
|
@@ -47,8 +47,8 @@ Describe "hooks tests" -Tag Chocolatey, Hooks {
|
47 | 47 | }
|
48 | 48 |
|
49 | 49 | # Uninstall/Upgrade exit -1: https://github.com/chocolatey/choco/issues/2822
|
50 |
| - It "Exits with Success (0,-1)" { |
51 |
| - $Output.ExitCode | Should -BeIn @(0, -1) -Because $Output.String |
| 50 | + It "Exits with expected value (<ExitCode>)" { |
| 51 | + $Output.ExitCode | Should -Be $ExitCode -Because $Output.String |
52 | 52 | }
|
53 | 53 |
|
54 | 54 | It "Should execute hooks (<RunsHooks>)" {
|
|
0 commit comments