Skip to content

Commit ddd9b12

Browse files
committed
test(Chocolatey): assert --yes is passed to choco upgrade
Regression guard: verifies the suppress-prompt flag survives future edits to Invoke-ChocoInstallPackage argument list.
1 parent 6d5d044 commit ddd9b12

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Tests/Chocolatey.Type.Tests.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ Describe 'Chocolatey script' -Tag 'WindowsOnly' -Skip:$SkipUnsupported {
3939
}
4040
}
4141

42+
It 'Passes --yes to choco upgrade to suppress interactive prompts' {
43+
$dep = New-PSDependFixture -DependencyName 'git' -DependencyType 'Chocolatey' -Version '2.0.2'
44+
InModuleScope PSDepend -Parameters @{ Dep = $dep; ScriptPath = $script:ScriptPath } {
45+
& $ScriptPath -Dependency $Dep -Force
46+
}
47+
Should -Invoke -CommandName Invoke-ExternalCommand -ModuleName PSDepend -Times 1 -Exactly -ParameterFilter {
48+
$Arguments -contains 'upgrade' -and $Arguments -contains '--yes'
49+
}
50+
}
51+
4252
It 'Invokes choco upgrade with -Force when -Force switch is set' {
4353
$dep = New-PSDependFixture -DependencyName 'git' -DependencyType 'Chocolatey' -Version '2.0.2'
4454
InModuleScope PSDepend -Parameters @{ Dep = $dep; ScriptPath = $script:ScriptPath } {

0 commit comments

Comments
 (0)