mirror of
https://github.com/TecharoHQ/anubis.git
synced 2025-08-04 02:08:59 -04:00

* fix(config): actually load threshold config Signed-off-by: Xe Iaso <me@xeiaso.net> * chore: spelling Signed-off-by: Xe Iaso <me@xeiaso.net> * test(lib): fix test failures Signed-off-by: Xe Iaso <me@xeiaso.net> --------- Signed-off-by: Xe Iaso <me@xeiaso.net>
37 lines
588 B
Go
37 lines
588 B
Go
package config
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
)
|
|
|
|
func TestGeoIPValid(t *testing.T) {
|
|
for _, tt := range []struct {
|
|
name string
|
|
input *GeoIP
|
|
err error
|
|
}{
|
|
{
|
|
name: "basic valid",
|
|
input: &GeoIP{
|
|
Countries: []string{"CA"},
|
|
},
|
|
},
|
|
{
|
|
name: "invalid country",
|
|
input: &GeoIP{
|
|
Countries: []string{"XOB"},
|
|
},
|
|
err: ErrNotCountryCode,
|
|
},
|
|
} {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if err := tt.input.Valid(); !errors.Is(err, tt.err) {
|
|
t.Logf("want: %v", tt.err)
|
|
t.Logf("got: %v", err)
|
|
t.Error("got wrong validation error")
|
|
}
|
|
})
|
|
}
|
|
}
|