fix: allow desktop release version history
Frontend CI / Frontend (push) Successful in 2m12s
Backend CI / Backend (push) Successful in 14m12s

This commit is contained in:
2026-06-10 13:13:06 +08:00
parent b646dfdc11
commit 6a4eaf2827
6 changed files with 202 additions and 31 deletions
@@ -97,6 +97,50 @@ func TestDesktopClientReleaseVersionPolicy(t *testing.T) {
require.False(t, minSupportedVersionRequiresUpdate(&minVersion, "1.2.0"))
}
func TestLatestDesktopClientReleasePrefersVersionThenArch(t *testing.T) {
t.Parallel()
oldX64 := domain.DesktopClientRelease{
ID: 1,
Platform: "win32",
Arch: "x64",
Channel: "stable",
Version: "0.1.0",
UpdatedAt: time.Date(2026, 6, 10, 10, 0, 0, 0, time.UTC),
}
newX64 := domain.DesktopClientRelease{
ID: 2,
Platform: "win32",
Arch: "x64",
Channel: "stable",
Version: "0.1.1",
UpdatedAt: time.Date(2026, 6, 10, 9, 0, 0, 0, time.UTC),
}
newUniversal := domain.DesktopClientRelease{
ID: 3,
Platform: "win32",
Arch: "universal",
Channel: "stable",
Version: "0.2.0",
UpdatedAt: time.Date(2026, 6, 10, 11, 0, 0, 0, time.UTC),
}
require.Equal(t, newX64.ID, latestDesktopClientRelease([]domain.DesktopClientRelease{
newUniversal,
oldX64,
newX64,
}).ID)
latestByTarget := latestDesktopClientReleasesByTarget([]domain.DesktopClientRelease{
oldX64,
newX64,
newUniversal,
})
require.Len(t, latestByTarget, 2)
require.Equal(t, newUniversal.ID, latestByTarget[0].ID)
require.Equal(t, newX64.ID, latestByTarget[1].ID)
}
func TestNormalizeDesktopClientReleaseUploadInput(t *testing.T) {
t.Parallel()