package webhook import "testing" func TestSpellingsOfOneTargetShareALane(t *testing.T) { want := hostOf("https://example.com/hook") for _, raw := range []string{ "https://Example.COM/hook", "https://example.com:443/hook", "https://example.com:8443/other", "https://example.com./hook", "https://user:pass@example.com/hook", "http://EXAMPLE.com", } { if got := hostOf(raw); got != want { t.Errorf("%s is lane %q, want %q like the plain spelling", raw, got, want) } } if hostOf("https://example.org/hook") == want { t.Error("another host shares the lane") } }