MCPcopy Create free account
hub / github.com/basecamp/hey-cli / TestValidateBaseURL

Function TestValidateBaseURL

internal/config/config_test.go:96–118  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

94}
95
96func TestValidateBaseURL(t *testing.T) {
97 tests := []struct {
98 url string
99 wantErr bool
100 }{
101 {"https://app.hey.com", false},
102 {"http://localhost:3000", false},
103 {"http://127.0.0.1:3000", false},
104 {"http://app.hey.localhost:3003", false},
105 {"http://insecure.example.com", true},
106 {"app.hey.com", true}, // bare path, no scheme
107 {"http://[::1]:3000", false}, // IPv6 loopback
108 }
109
110 for _, tt := range tests {
111 t.Run(tt.url, func(t *testing.T) {
112 err := validateBaseURL(tt.url)
113 if (err != nil) != tt.wantErr {
114 t.Errorf("validateBaseURL(%q) error = %v, wantErr %v", tt.url, err, tt.wantErr)
115 }
116 })
117 }
118}
119
120func TestSourceTracking(t *testing.T) {
121 tmp := t.TempDir()

Callers

nothing calls this directly

Calls 1

validateBaseURLFunction · 0.85

Tested by

no test coverage detected