Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pester tests #1033

Merged
merged 2 commits into from
Dec 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Import-Module ./helpers/gui-helpers.psm1
Import-Module ../helpers/gui-helpers.psm1

Describe "chocolateyguicli" -Tag ChocolateyGuiCli {
BeforeDiscovery {
Expand Down 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
}
}
}
Loading