Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFarhad H. P. Shirvan <9374298+farhadh@users.noreply.github.com>2026-04-28 19:46:55 +0300
committerGitHub <noreply@github.com>2026-04-28 19:46:55 +0300
commitf21ed9229695ed1cbcc86d65b52d98cfc9116f5a (patch)
treed1c96f66fe973005aebc6b065e949f3725f1527d /web/service/panel_test.go
parent22de983752fb4cc10bd16b756c4ccaab239e2e3b (diff)
feat: add panel update functionality via web GUI (#4117)
* feat: add panel update functionality via web GUI * feat: enhance panel update notifications in web GUI * feat: implement panel update modal and enhance translation strings * fix design
Diffstat (limited to 'web/service/panel_test.go')
-rw-r--r--web/service/panel_test.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/web/service/panel_test.go b/web/service/panel_test.go
new file mode 100644
index 00000000..44e9ba34
--- /dev/null
+++ b/web/service/panel_test.go
@@ -0,0 +1,41 @@
+package service
+
+import "testing"
+
+func TestIsNewerVersion(t *testing.T) {
+ cases := []struct {
+ latest string
+ current string
+ want bool
+ }{
+ {"v2.9.4", "2.9.3", true},
+ {"v2.10.0", "2.9.9", true},
+ {"v2.9.3", "2.9.3", false},
+ {"v2.9.2", "2.9.3", false},
+ {"v3.0.0", "2.9.3", true},
+ }
+
+ for _, tc := range cases {
+ if got := isNewerVersion(tc.latest, tc.current); got != tc.want {
+ t.Fatalf("isNewerVersion(%q, %q) = %v, want %v", tc.latest, tc.current, got, tc.want)
+ }
+ }
+}
+
+func TestCompareVersionStringsRejectsUnexpectedFormats(t *testing.T) {
+ if _, ok := compareVersionStrings("latest", "2.9.3"); ok {
+ t.Fatal("expected non-semver latest tag to be rejected")
+ }
+ if _, ok := compareVersionStrings("v2.9", "2.9.3"); ok {
+ t.Fatal("expected short version to be rejected")
+ }
+}
+
+func TestShellQuote(t *testing.T) {
+ if got := shellQuote("/usr/bin/curl"); got != "'/usr/bin/curl'" {
+ t.Fatalf("unexpected quote result: %s", got)
+ }
+ if got := shellQuote("/tmp/a'b"); got != "'/tmp/a'\\''b'" {
+ t.Fatalf("unexpected quote result with single quote: %s", got)
+ }
+}