Files
QWQLwToo 079ee4eaeb
build-winui / winui (push) Has been cancelled
Add server components
2026-06-26 13:28:09 +08:00

39 lines
992 B
Go

package utils
import "testing"
func TestGetLatestProductReleaseUsesYmhutBoxAliases(t *testing.T) {
products := ProductsInfo{
"YmhutBox": {
{
Version: "2.0.0",
FileName: "YmhutBox Setup 2.0.0.exe",
DownloadPath: "/downloads/YmhutBox Setup 2.0.0.exe",
UpdateTime: "2026-04-28 04:48:25",
},
},
"YMhut Box": {
{
Version: "2.0.1",
FileName: "YMhut_Box_Setup_2.0.1.exe",
DownloadPath: "/downloads/YMhut_Box_Setup_2.0.1.exe",
UpdateTime: "2026-04-30 17:27:21",
},
},
}
productName, release := GetLatestProductRelease(products, "YMhut Box")
if release == nil {
t.Fatal("expected a release")
}
if productName != "YMhut Box" {
t.Fatalf("expected YMhut Box alias to win, got %q", productName)
}
if release.Version != "2.0.1" {
t.Fatalf("expected version 2.0.1, got %q", release.Version)
}
if release.FileName != "YMhut_Box_Setup_2.0.1.exe" {
t.Fatalf("expected new installer, got %q", release.FileName)
}
}