Skip to content

Commit

Permalink
(#158) Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vexx32 committed May 24, 2023
1 parent b669b9d commit 7cc1a7c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tests/chocolatey-tests/commands/choco-list.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,27 @@ Describe "choco list" -Tag Chocolatey, ListCommand {

Context "Listing local packages with unsupported argument outputs warning" -ForEach @('-l', '-lo', '--lo', '--local', '--localonly', '--local-only', '--order-by-popularity', '-a', '--all', '--allversions', '--all-versions', '-li', '-il', '-lai', '-lia', '-ali', '-ail', '-ial', '-ila') {
BeforeAll {
$LogPath = "$env:ChocolateyInstall\logs\chocolatey.log"
$OldLogContent = Get-Content $LogPath
Remove-Item -Path $LogPath

$Output = Invoke-Choco list $_
$LogFile = Get-Content -Path $LogPath

# Logs are picked up by CI for investigation if needed, so we'll keep both full sets of logs.
@(
$OldLogContent
$LogFile
) | Set-Content -Path $LogPath
}

It "Exits with Success (0)" {
$Output.ExitCode | Should -Be 0
}

It "Should contain expected warning message" {
$Output.Lines | Should -Contain "UNSUPPORTED ARGUMENT: Ignoring the argument $_. This argument is unsupported for locally installed packages, and will be treated as a package name in Chocolatey CLI v3!"
It "Should contain expected warning message in the logs" {
@($LogFile) -match "Ignoring the argument $_. This argument is unsupported for locally installed packages." |
Should -Not -BeNullOrEmpty
}
}
}

0 comments on commit 7cc1a7c

Please sign in to comment.