fix system update current version display

This commit is contained in:
ShukeBta
2026-07-02 00:04:04 +08:00
parent 3bea1ca276
commit 5ecb5e2144
7 changed files with 63 additions and 21 deletions
+19
View File
@@ -1,6 +1,7 @@
package service
import (
"context"
"os"
"path/filepath"
"strings"
@@ -152,3 +153,21 @@ func TestSystemUpdateOutputDetailsKeepsTail(t *testing.T) {
t.Fatalf("details length = %d, want 12", len(got))
}
}
func TestSystemUpdateStatusIncludesCurrentVersion(t *testing.T) {
svc := NewSystemUpdateService(nil, nil, nil, nil, "MediaStationGo-v0.0.99")
status := svc.Status(context.Background())
if status.CurrentVersion != "MediaStationGo-v0.0.99" {
t.Fatalf("current_version = %q, want MediaStationGo-v0.0.99", status.CurrentVersion)
}
}
func TestSystemUpdateStatusDefaultsCurrentVersion(t *testing.T) {
svc := NewSystemUpdateService(nil, nil, nil, nil, "")
status := svc.Status(context.Background())
if status.CurrentVersion != "dev" {
t.Fatalf("current_version = %q, want dev", status.CurrentVersion)
}
}