Files
navi/internal/geoflag/geoflag_test.go
T
NavisandCursor 77bd7da861 Release 3.9.0+3: subscription-URL routing, emoji flags, Remnawave provisioning.
Route credential-less http(s) URLs pasted into the add-link field to
subscription import (fixes remaining 'proxy URI missing username').
Extend geoflag with RU country names and city hints; live Remnawave
names already carrying emoji flags are kept as-is. Add admin
provisioning via configs/remnawave-api.json (GET by-username / POST
users, 50 GB MONTH plan) and the «Выдать доступ» UI panel.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 17:36:54 +03:00

39 lines
981 B
Go

package geoflag
import "testing"
func TestFromText(t *testing.T) {
cases := []struct {
in, cc string
}{
{"DE-Frankfurt-1", "DE"},
{"[NL] Amsterdam", "NL"},
{"🇺🇸 US West", "US"},
{"Germany Hetzner", "DE"},
{"unknown-node", ""},
// Russian country names.
{"Германия-1", "DE"},
{"Нидерланды Fast", "NL"},
{"Сервер Швейцария", "CH"},
{"США восток", "US"},
{"Великобритания", "GB"},
// City → country hints.
{"Frankfurt-Hetzner", "DE"},
{"Амстердам 2", "NL"},
{"node-helsinki", "FI"},
// Names from live Remnawave subscription (emoji comes first).
{"🇨🇿 Czech Republic Vless", "CZ"},
{"🇳🇴 Norway TR+WS", "NO"},
{"🇩🇪 Germany 3 HY", "DE"},
}
for _, c := range cases {
cc, emoji := FromText(c.in)
if cc != c.cc {
t.Fatalf("%q: got cc %q want %q", c.in, cc, c.cc)
}
if c.cc != "" && emoji == "" {
t.Fatalf("%q: empty emoji", c.in)
}
}
}