package persona import "testing" func TestValidateIPAllowlist(t *testing.T) { in := []string{"10.0.0.0/8", " 192.168.1.5 ", "not-an-ip", "", "2001:db8::/32", "garbage/99"} got := validateIPAllowlist(in, "test") want := map[string]bool{"10.0.0.0/8": true, "192.168.1.5": true, "2001:db8::/32": true} if len(got) != len(want) { t.Fatalf("got %v, want %d valid entries", got, len(want)) } for _, e := range got { if !want[e] { t.Errorf("unexpected entry kept: %q", e) } } }