test: cover base URL repository override
This commit is contained in:
@@ -16,7 +16,9 @@ func TestNormalizeRepoURL(t *testing.T) {
|
|||||||
wantOK bool
|
wantOK bool
|
||||||
}{
|
}{
|
||||||
{name: "https", remoteURL: "https://git.hrafn.xyz/aether/vociferate.git", wantURL: "https://git.hrafn.xyz/aether/vociferate", wantOK: true},
|
{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", 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: "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: "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},
|
{name: "empty", remoteURL: "", wantURL: "", wantOK: false},
|
||||||
@@ -123,7 +125,7 @@ func TestDeriveRepositoryURLFromGitConfigFallback(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDeriveRepositoryURL_UsesOverrideAsHighestPriority(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_SERVER_URL", "http://teapot:3000")
|
||||||
t.Setenv("GITHUB_REPOSITORY", "aether/vociferate")
|
t.Setenv("GITHUB_REPOSITORY", "aether/vociferate")
|
||||||
|
|
||||||
@@ -140,7 +142,7 @@ func TestDeriveRepositoryURL_UsesOverrideAsHighestPriority(t *testing.T) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
t.Fatal("expected repository URL from override")
|
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)
|
t.Fatalf("unexpected repository URL: %q", url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user