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

Function TestSpec_PublicAPI_NormalizeGitHubHostURL

pkg/stringutil/spec_test.go:409–434  ·  view source on GitHub ↗

TestSpec_PublicAPI_NormalizeGitHubHostURL validates the documented behavior of NormalizeGitHubHostURL as described in the package README.md. Specification: "Normalizes a GitHub host URL by ensuring it has an https:// scheme and no trailing slash. Accepts bare hostnames, URLs with or without a schem

(t *testing.T)

Source from the content-addressed store, hash-verified

407// stringutil.NormalizeGitHubHostURL("github.example.com") // "https://github.example.com"
408// stringutil.NormalizeGitHubHostURL("https://github.com/") // "https://github.com"
409func TestSpec_PublicAPI_NormalizeGitHubHostURL(t *testing.T) {
410 tests := []struct {
411 name string
412 input string
413 expected string
414 }{
415 {
416 name: "bare hostname gets https scheme (documented example)",
417 input: "github.example.com",
418 expected: "https://github.example.com",
419 },
420 {
421 name: "trailing slash removed from https URL (documented example)",
422 input: "https://github.com/",
423 expected: "https://github.com",
424 },
425 }
426
427 for _, tt := range tests {
428 t.Run(tt.name, func(t *testing.T) {
429 result := NormalizeGitHubHostURL(tt.input)
430 assert.Equal(t, tt.expected, result,
431 "NormalizeGitHubHostURL(%q) should match documented output", tt.input)
432 })
433 }
434}
435
436// TestSpec_PublicAPI_ExtractDomainFromURL validates the documented behavior of
437// ExtractDomainFromURL as described in the package README.md.

Callers

nothing calls this directly

Calls 2

NormalizeGitHubHostURLFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected