MCPcopy Create free account
hub / github.com/github/gh-aw / TestExtractDomainFromURL

Function TestExtractDomainFromURL

pkg/cli/access_log_test.go:139–157  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

137}
138
139func TestExtractDomainFromURL(t *testing.T) {
140 tests := []struct {
141 url string
142 expected string
143 }{
144 {"http://example.com/path", "example.com"},
145 {"https://api.github.com/repos", "api.github.com"},
146 {"github.com:443", "github.com"},
147 {"malicious.site", "malicious.site"},
148 {"http://sub.domain.com:8080/path", "sub.domain.com"},
149 }
150
151 for _, tt := range tests {
152 t.Run(tt.url, func(t *testing.T) {
153 result := stringutil.ExtractDomainFromURL(tt.url)
154 assert.Equal(t, tt.expected, result, "should extract correct domain from URL")
155 })
156 }
157}
158
159func TestParseSquidLogLine(t *testing.T) {
160 tests := []struct {

Callers

nothing calls this directly

Calls 2

ExtractDomainFromURLFunction · 0.92
RunMethod · 0.45

Tested by

no test coverage detected