Skip to content

Commit

Permalink
TESTS Match on the string output instead of lines containing...
Browse files Browse the repository at this point in the history
  • Loading branch information
corbob committed Aug 26, 2024
1 parent 30d0513 commit e1a6373
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/pester-tests/commands/choco-upgrade.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ To upgrade a local, or remote file, you may use:
Version = '2.1.0'
}

Restore-ChocolateyInstallSnapshot -NoSnapshotCopy
Restore-ChocolateyInstallSnapshot

$Setup = Invoke-Choco install $DependentPackage.Name --version $DependentPackage.Version --confirm
$Setup2 = Invoke-Choco install $BasePackage --version 1.0.0 --confirm
Expand All @@ -822,12 +822,12 @@ To upgrade a local, or remote file, you may use:
if ($AllowsDowngrade) {
$Output.Lines | Should -Not -Contain 'A newer version of isdependency (v2.1.0) is already installed.' -Because $Output.String
$Output.Lines | Should -Not -Contain 'Use --allow-downgrade or --force to attempt to install older versions.' -Because $Output.String
$Output.Lines | Should -Contain 'Chocolatey upgraded 2/2 packages.' -Because $Output.String
$Output.String | Should -MatchExactly 'Chocolatey upgraded 2/\d+ packages.'
}
else {
$Output.Lines | Should -Contain 'A newer version of isdependency (v2.1.0) is already installed.' -Because $Output.String
$Output.Lines | Should -Contain 'Use --allow-downgrade or --force to attempt to install older versions.' -Because $Output.String
$Output.Lines | Should -Contain 'Chocolatey upgraded 0/2 packages. 2 packages failed.' -Because $Output.String
$Output.String | Should -MatchExactly 'Chocolatey upgraded 0/\d+ packages. 2 packages failed.'
}
}
}
Expand Down

0 comments on commit e1a6373

Please sign in to comment.