Release 3.9.0+1: Remnawave API configs, Remnawave-style UI with flags, Windows build.
EOF Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package remnawave
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestPublicSubURL(t *testing.T) {
|
||||
got := PublicSubURL("https://panel.example.com/api/", "abc12")
|
||||
want := "https://panel.example.com/api/sub/abc12"
|
||||
if got != want {
|
||||
t.Fatalf("got %q want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseInput(t *testing.T) {
|
||||
base, short, ok := ParseInput("https://vpn.example.com/api/sub/xyz789/clash")
|
||||
if !ok || base != "https://vpn.example.com" || short != "xyz789" {
|
||||
t.Fatalf("got base=%q short=%q ok=%v", base, short, ok)
|
||||
}
|
||||
_, _, ok = ParseInput("https://example.com/not-a-sub")
|
||||
if ok {
|
||||
t.Fatal("expected not ok")
|
||||
}
|
||||
}
|
||||
|
||||
func TestExtractSubscriptionURL(t *testing.T) {
|
||||
body := `{"response":{"subscriptionUrl":"https://vpn.example.com/api/sub/abc"}}`
|
||||
got := extractSubscriptionURL(body)
|
||||
if got != "https://vpn.example.com/api/sub/abc" {
|
||||
t.Fatalf("got %q", got)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user