Normalized Routing
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package topdata
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestParseRepoSpecNormalizesWestgateSSHHostToPublicGiteaHost(t *testing.T) {
|
||||
spec, ok := parseRepoSpec("ssh://git@git-ssh.westgate.pw:2222/ShadowsOverWestgate/sow-module.git")
|
||||
if !ok {
|
||||
t.Fatal("expected SSH remote to parse")
|
||||
}
|
||||
if spec.BaseURL != "https://gitea.westgate.pw" {
|
||||
t.Fatalf("expected public Gitea base URL, got %q", spec.BaseURL)
|
||||
}
|
||||
if spec.Owner != "ShadowsOverWestgate" || spec.Repo != "sow-module" {
|
||||
t.Fatalf("unexpected repo spec: %#v", spec)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseRepoSpecKeepsHTTPRemoteHost(t *testing.T) {
|
||||
spec, ok := parseRepoSpec("https://example.invalid/owner/repo.git")
|
||||
if !ok {
|
||||
t.Fatal("expected HTTPS remote to parse")
|
||||
}
|
||||
if spec.BaseURL != "https://example.invalid" {
|
||||
t.Fatalf("expected HTTPS base URL to be preserved, got %q", spec.BaseURL)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user