Skip to content

Commit 77095bb

Browse files
committed
(chocolatey#3804) Update test use package with full details
This updates the tests used for choco info --local-only to use a package that will include all of the details being tested. It also adjusts the comparison for scenarios where the source won't necessarily be known until the test is fully run.
1 parent 466e231 commit 77095bb

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

tests/pester-tests/commands/choco-info.Tests.ps1

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,28 @@
3636

3737
Context "Should display source and deployment locations when using --local-only" {
3838
BeforeAll {
39-
Initialize-ChocolateyTestInstall -Source $PSScriptRoot\testpackages
40-
41-
$Setup = Invoke-Choco install installpackage
39+
New-ChocolateyInstallSnapshot
40+
$PackageUnderTest = 'pureportable'
41+
Enable-ChocolateySource -Name hermes-setup
4242

43+
$Setup = Invoke-Choco install $PackageUnderTest
4344
$Setup.ExitCode | Should -Be 0 -Because $Setup.String
4445

45-
$Output = Invoke-Choco info installpackage --local-only
46+
$Output = Invoke-Choco info $PackageUnderTest --local-only
47+
}
48+
49+
AfterAll {
50+
Remove-ChocolateyInstallSnapshot
4651
}
4752

4853
It "Exits with Success (0)" {
4954
$Output.ExitCode | Should -Be 0 -Because $Output.String
5055
}
5156

5257
It "Should contain source and deployment location summary" {
53-
$Output.Lines | Should -Contain "Source package was installed from: $PSScriptRoot\testpackages" -Because $Output.String
54-
$Output.String | Should -Match "Deployed to:"
58+
# We do not necessarily know what source will be used, so we match on the leading string.
59+
$Output.String | Should -Match "Source package was installed from: '"
60+
$Output.String | Should -Match "Deployed to: '"
5561
}
5662
}
5763

0 commit comments

Comments
 (0)