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") } }