Skip to content

Commit

Permalink
(tests) Update Pester tests to be consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
corbob committed Dec 20, 2023
1 parent 8514c94 commit 3ec0dc4
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Tests/pester-tests/chocolateyguicli.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,21 @@ Describe "chocolateyguicli" -Tag ChocolateyGuiCli {
$Output.String | Should -Match $Name
}
}

Context "Toggles the feature (<_.Name>) successfully" -ForEach $Features {
BeforeAll {
$Outputs = if ($Enabled) {
Invoke-GuiCli feature disable --name $_.Name
Invoke-GuiCli feature enable --name $_.Name
if ($Enabled) {
$DisableOutput = Invoke-GuiCli feature disable --name $_.Name
$EnableOutput = Invoke-GuiCli feature enable --name $_.Name
} else {
Invoke-GuiCli feature enable --name $_.Name
Invoke-GuiCli feature disable --name $_.Name
$EnableOutput = Invoke-GuiCli feature enable --name $_.Name
$DisableOutput = Invoke-GuiCli feature disable --name $_.Name
}
}

It "Should exit success" {
$Outputs.ExitCode | Should -Not -Contain 1
It "Should exit success (0)" {
$EnableOutput.ExitCode | Should -Be 0 -Because $EnableOutput.String
$DisableOutput.ExitCode | Should -Be 0 -Because $DisableOutput.String
}
}
}

0 comments on commit 3ec0dc4

Please sign in to comment.