test: cover base URL repository override

This commit is contained in:
Micheal Wilkinson
2026-03-20 23:51:57 +00:00
parent 2d3c27460f
commit 6a83abe4db

View File

@@ -16,7 +16,9 @@ func TestNormalizeRepoURL(t *testing.T) {
wantOK bool
}{
{name: "https", remoteURL: "https://git.hrafn.xyz/aether/vociferate.git", wantURL: "https://git.hrafn.xyz/aether/vociferate", wantOK: true},
{name: "https trailing slash", remoteURL: "https://git.hrafn.xyz/aether/vociferate/", wantURL: "https://git.hrafn.xyz/aether/vociferate", wantOK: true},
{name: "http", remoteURL: "http://teapot:3000/aether/vociferate.git", wantURL: "http://teapot:3000/aether/vociferate", wantOK: true},
{name: "http trailing slash", remoteURL: "http://teapot:3000/aether/vociferate/", wantURL: "http://teapot:3000/aether/vociferate", wantOK: true},
{name: "ssh with scheme", remoteURL: "ssh://git@git.hrafn.xyz/aether/vociferate.git", wantURL: "https://git.hrafn.xyz/aether/vociferate", wantOK: true},
{name: "scp style", remoteURL: "git@git.hrafn.xyz:aether/vociferate.git", wantURL: "https://git.hrafn.xyz/aether/vociferate", wantOK: true},
{name: "empty", remoteURL: "", wantURL: "", wantOK: false},
@@ -123,7 +125,7 @@ func TestDeriveRepositoryURLFromGitConfigFallback(t *testing.T) {
}
func TestDeriveRepositoryURL_UsesOverrideAsHighestPriority(t *testing.T) {
t.Setenv("VOCIFERATE_REPOSITORY_URL", "https://git.hrafn.xyz/aether/vociferate")
t.Setenv("VOCIFERATE_REPOSITORY_URL", "https://git.hrafn.xyz/git")
t.Setenv("GITHUB_SERVER_URL", "http://teapot:3000")
t.Setenv("GITHUB_REPOSITORY", "aether/vociferate")
@@ -140,7 +142,7 @@ func TestDeriveRepositoryURL_UsesOverrideAsHighestPriority(t *testing.T) {
if !ok {
t.Fatal("expected repository URL from override")
}
if url != "https://git.hrafn.xyz/aether/vociferate" {
if url != "https://git.hrafn.xyz/git/aether/vociferate" {
t.Fatalf("unexpected repository URL: %q", url)
}
}