Files
wehub-resource-sync 26f897c1ec
release / release-please (push) Failing after 1m49s
docs / build (push) Failing after 6m34s
release / build-and-upload (arm64, linux) (push) Has been cancelled
release / build-and-upload (arm64, windows) (push) Has been cancelled
release / build-darwin (amd64, darwin) (push) Has been cancelled
release / checksums (push) Has been cancelled
release / finalize (push) Has been cancelled
release / build-darwin (arm64, darwin) (push) Has been cancelled
release / build-and-upload (amd64, linux) (push) Has been cancelled
release / build-and-upload (amd64, windows) (push) Has been cancelled
docs / deploy (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:34:16 +08:00

48 lines
1.1 KiB
Go

package cli
import (
"strings"
"testing"
)
func TestUpdateCommandDevBuild(t *testing.T) {
isolateUpdateCommand(t)
out, err := executeCmd("update")
if err != nil {
t.Fatalf("update failed: %v\noutput: %s", err, out)
}
if !strings.Contains(out, "self-update unavailable for development builds") {
t.Fatalf("unexpected update output: %s", out)
}
}
func TestUpdateCommandBetaFlag(t *testing.T) {
isolateUpdateCommand(t)
out, err := executeCmd("update", "--beta")
if err != nil {
t.Fatalf("update --beta failed: %v\noutput: %s", err, out)
}
if !strings.Contains(out, "self-update unavailable for development builds") {
t.Fatalf("unexpected update output: %s", out)
}
}
func TestUpdateCommandYesFlag(t *testing.T) {
isolateUpdateCommand(t)
out, err := executeCmd("update", "-y")
if err != nil {
t.Fatalf("update -y failed: %v\noutput: %s", err, out)
}
if !strings.Contains(out, "self-update unavailable for development builds") {
t.Fatalf("unexpected update output: %s", out)
}
}
func isolateUpdateCommand(t *testing.T) {
t.Helper()
t.Setenv("NM_HOME", t.TempDir())
}