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)
| 407 | // stringutil.NormalizeGitHubHostURL("github.example.com") // "https://github.example.com" |
| 408 | // stringutil.NormalizeGitHubHostURL("https://github.com/") // "https://github.com" |
| 409 | func 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. |
nothing calls this directly
no test coverage detected