1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
package registry
import (
"testing"
"github.com/matryer/is"
)
func TestSource(t *testing.T) {
assert := is.New(t)
tt := []struct {
Name string
Source *Source
CloneURL string
}{
{
Name: "Gitea",
Source: &Source{
URL: "https://gitea.com/",
},
CloneURL: "https://gitea.com/user/repo.git",
},
{
Name: "GitHub",
Source: &Source{
URL: "https://github.com/",
},
CloneURL: "https://github.com/user/repo.git",
},
{
Name: "GitLab",
Source: &Source{
URL: "https://gitlab.com/",
},
CloneURL: "https://gitlab.com/user/repo.git",
},
}
namespace := "user/repo"
for _, tc := range tt {
t.Run(tc.Name, func(t *testing.T) {
cloneURL := tc.Source.CloneURL(namespace)
assert.Equal(tc.CloneURL, cloneURL) // Clone URLs should match
})
}
}
|