Files
Prism/internal/geodata/geodata_test.go
T
renjue fe8ea784d0
CI / docker (push) Successful in 2m54s
feat: Prism HTTP/SOCKS5 代理网关及管理台
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-23 15:58:28 +08:00

24 lines
676 B
Go

package geodata
import "testing"
func TestConfigFromSettingsUsesDefaults(t *testing.T) {
cfg := ConfigFromSettings(map[string]string{})
def := DefaultConfig()
if cfg.CountryMmdbURL != def.CountryMmdbURL || cfg.GeoIPURL != def.GeoIPURL || cfg.GeoSiteURL != def.GeoSiteURL {
t.Fatalf("expected defaults, got %+v", cfg)
}
}
func TestConfigFromSettingsOverrides(t *testing.T) {
cfg := ConfigFromSettings(map[string]string{
"geo_geoip_url": "https://example.com/geoip.dat",
})
if cfg.GeoIPURL != "https://example.com/geoip.dat" {
t.Fatalf("got %q", cfg.GeoIPURL)
}
if cfg.GeoSiteURL != DefaultConfig().GeoSiteURL {
t.Fatalf("expected default geosite url")
}
}