Skip to content

Commit

Permalink
Show the correct latest version for all packages (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanbergstrom committed Feb 17, 2023
1 parent 0b965b6 commit 0301739
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.0.2] - 2023-02-16

### Fixed

- Package search no longer should show the wrong latest version of a package (#2)

## [0.0.1] - 2023-02-16

Initial release

[Unreleased]: https://github.com/AnyPackage/AnyPackage.WinGet/compare/v0.1.0...HEAD
[0.0.2]: https://github.com/AnyPackage/AnyPackage.WinGet/releases/tag/v0.0.2
[0.0.1]: https://github.com/AnyPackage/AnyPackage.WinGet/releases/tag/v0.0.1
2 changes: 1 addition & 1 deletion src/AnyPackage.WinGet.psd1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@{
RootModule = 'AnyPackage.WinGet.psm1'
ModuleVersion = '0.0.1'
ModuleVersion = '0.0.2'
CompatiblePSEditions = @('Desktop', 'Core')
GUID = '47e987f7-7d96-4e7b-853e-182ee6e396ae'
Author = 'Ethan Bergstrom'
Expand Down
2 changes: 1 addition & 1 deletion src/private/Find-WinGetPackage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function Find-WinGetPackage {
# Perform an additional query to get all available versions, and create a package object for each version
$version = Cobalt\Get-WinGetPackageInfo -ID $candidate.ID -Versions -Source $selectedSource |
Where-Object {-Not $Request.Version -Or (([NuGet.Versioning.VersionRange]$Request.Version).Satisfies($_))} |
Sort-Object -Descending | Select-Object -First 1
Select-Object -First 1

# WinGet doesn't return source information when source is specified, so we have to construct a fresh object here with the source information included
$candidate | Select-Object -Property ID,@{
Expand Down
4 changes: 4 additions & 0 deletions tests/AnyPackage.WinGet.Unit.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ Describe 'basic package search operations' {
It 'searches for the latest version of a package' {
Find-Package -Name $package | Where-Object {$_.Name -contains $package} | Should -Not -BeNullOrEmpty
}
It 'displays the correct latest version of a package' {
# The version of Firefox in the repository should never be lower than the version installed on the runner
(Find-Package 'Mozilla.Firefox').Version -ge (Get-Package 'Mozilla.Firefox').Version | Should -Be True
}
It 'searches for all versions of a package' {
Find-Package -Name $package -Version '[0,]' | Where-Object {$_.Name -contains $package} | Should -Not -BeNullOrEmpty
}
Expand Down

0 comments on commit 0301739

Please sign in to comment.