~james/core

core/spindle/webhook/webhook_lane_test.go -rw-r--r-- 586 bytes
452f17b7 — james chore(import): snapshot james.dad.town/core at f70c71c7696a 16 hours ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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")
	}
}