Skip to content

Commit 0301739

Browse files
Show the correct latest version for all packages (#3)
1 parent 0b965b6 commit 0301739

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [0.0.2] - 2023-02-16
10+
11+
### Fixed
12+
13+
- Package search no longer should show the wrong latest version of a package (#2)
14+
915
## [0.0.1] - 2023-02-16
1016

1117
Initial release
1218

1319
[Unreleased]: https://github.com/AnyPackage/AnyPackage.WinGet/compare/v0.1.0...HEAD
20+
[0.0.2]: https://github.com/AnyPackage/AnyPackage.WinGet/releases/tag/v0.0.2
1421
[0.0.1]: https://github.com/AnyPackage/AnyPackage.WinGet/releases/tag/v0.0.1

src/AnyPackage.WinGet.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@{
22
RootModule = 'AnyPackage.WinGet.psm1'
3-
ModuleVersion = '0.0.1'
3+
ModuleVersion = '0.0.2'
44
CompatiblePSEditions = @('Desktop', 'Core')
55
GUID = '47e987f7-7d96-4e7b-853e-182ee6e396ae'
66
Author = 'Ethan Bergstrom'

src/private/Find-WinGetPackage.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function Find-WinGetPackage {
4747
# Perform an additional query to get all available versions, and create a package object for each version
4848
$version = Cobalt\Get-WinGetPackageInfo -ID $candidate.ID -Versions -Source $selectedSource |
4949
Where-Object {-Not $Request.Version -Or (([NuGet.Versioning.VersionRange]$Request.Version).Satisfies($_))} |
50-
Sort-Object -Descending | Select-Object -First 1
50+
Select-Object -First 1
5151

5252
# WinGet doesn't return source information when source is specified, so we have to construct a fresh object here with the source information included
5353
$candidate | Select-Object -Property ID,@{

tests/AnyPackage.WinGet.Unit.Tests.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ Describe 'basic package search operations' {
1818
It 'searches for the latest version of a package' {
1919
Find-Package -Name $package | Where-Object {$_.Name -contains $package} | Should -Not -BeNullOrEmpty
2020
}
21+
It 'displays the correct latest version of a package' {
22+
# The version of Firefox in the repository should never be lower than the version installed on the runner
23+
(Find-Package 'Mozilla.Firefox').Version -ge (Get-Package 'Mozilla.Firefox').Version | Should -Be True
24+
}
2125
It 'searches for all versions of a package' {
2226
Find-Package -Name $package -Version '[0,]' | Where-Object {$_.Name -contains $package} | Should -Not -BeNullOrEmpty
2327
}

0 commit comments

Comments
 (0)