10
"github.com/stretchr/testify/assert"
13
func str2url(raw string) *url.URL {
14
u, _ := url.Parse(raw)
18
func TestDetermineEndpoint(t *testing.T) {
33
cloneurl: "https://git.com/repo",
35
expected: str2url("https://git.com/repo.git/info/lfs"),
39
cloneurl: "https://git.com/repo.git",
41
expected: str2url("https://git.com/repo.git/info/lfs"),
46
lfsurl: "https://gitlfs.com/repo",
47
expected: str2url("https://gitlfs.com/repo"),
51
cloneurl: "https://git.com/repo.git",
52
lfsurl: "https://gitlfs.com/repo",
53
expected: str2url("https://gitlfs.com/repo"),
57
cloneurl: "git://git.com/repo.git",
59
expected: str2url("https://git.com/repo.git/info/lfs"),
64
lfsurl: "git://gitlfs.com/repo",
65
expected: str2url("https://gitlfs.com/repo"),
69
for n, c := range cases {
70
ep := DetermineEndpoint(c.cloneurl, c.lfsurl)
72
assert.Equal(t, c.expected, ep, "case %d: error should match", n)