Skip to content

Commit

Permalink
(chocolatey#1332) Add tests for disabling archive extraction logging
Browse files Browse the repository at this point in the history
This commit adds two new tests for the upcoming
functionality that has been added that allows
maintainers to specify an extra argument when
extracting zip archives to not log out the file
paths that are inside of the archive.
  • Loading branch information
AdmiringWorm committed Sep 22, 2022
1 parent c3f8efa commit 13968e9
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/chocolatey-tests/choco-install.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1392,4 +1392,36 @@ Describe "choco install" -Tag Chocolatey, InstallCommand {
$result2.Lines | Should -Contain "Circular dependency detected 'circulardependency2 0.0.1 => circulardependency1 0.0.1 => circulardependency2 0.0.1'."
}
}

Context "Installing package that extracts local zip archive while disabling logging" {
BeforeAll {
Restore-ChocolateyInstallSnapshot

$Output = Invoke-Choco install zip-log-disable-test --verbose --debug -y
}

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

It "Does not output extracted file path '<_>'" -ForEach @('tools\'; 'tools\chocolateybeforemodify.ps1'; 'tools\chocolateyinstall.ps1'; 'tools\chocolateyuninstall.ps1'; 'zip-log-disable-test.nuspec') {
$Output.String | Should -Not -Match "- $([regex]::Escape($_))"
}
}

Context "Installing package that extracts external zip archive while disabling logging" -Tag Internal {
BeforeAll {
Restore-ChocolateyInstallSnapshot

$Output = Invoke-Choco install zip-log-disable-test-external --verbose --debug -y
}

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

It "Does not output extracted file path '<_>'" -ForEach @('tools\'; 'tools\chocolateybeforemodify.ps1'; 'tools\chocolateyinstall.ps1'; 'tools\chocolateyuninstall.ps1'; 'zip-log-disable-test.nuspec') {
$Output.String | Should -Not -Match "- $([regex]::Escape($_))"
}
}
}

0 comments on commit 13968e9

Please sign in to comment.