Skip to content

Commit

Permalink
(chocolatey#2899) Add end to end tests
Browse files Browse the repository at this point in the history
Exercise the same checks as in the unit tests, but this time within the
context of Pester, to ensure direct exercising of choco.exe.
  • Loading branch information
gep13 committed Apr 13, 2023
1 parent e89a85f commit 164696e
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/chocolatey-tests/commands/choco-info.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,36 @@ Describe "choco info" -Tag Chocolatey, InfoCommand {
}
}

Context "Listing package information when more than one package ID is provided" -Tag gep13infocheck {
BeforeAll {
Remove-NuGetPaths
$Output = Invoke-Choco info foo bar
}

It "Exits with Failure (1)" {
$Output.ExitCode | Should -Be 1 -Because $Output.String
}

It "Reports a package ID is required" {
$Output.Lines | Should -Contain 'Only a single package name can be passed to the choco info command.'
}
}

Context "Listing package information when no package ID is provided" -Tag gep13infocheck {
BeforeAll {
Remove-NuGetPaths
$Output = Invoke-Choco info
}

It "Exits with Failure (1)" {
$Output.ExitCode | Should -Be 1 -Because $Output.String
}

It "Reports a package ID is required" {
$Output.Lines | Should -Contain 'A single package name is required to run the choco info command.'
}
}

# Issue: https://gitlab.com/chocolatey/collaborators/choco-licensed/-/issues/530 (NOTE: Proxy bypassing also works on Chocolatey FOSS)
# These are skipped on Proxy tests because the proxy server can't be bypassed in that test environment.
Context "Listing package information when using proxy and proxy bypass list in config" -Tag ProxySkip -Skip:(!$licensedProxyFixed) {
Expand Down

0 comments on commit 164696e

Please # to comment.