forked from amirashad/ghctl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit_test.go
More file actions
42 lines (39 loc) · 901 Bytes
/
git_test.go
File metadata and controls
42 lines (39 loc) · 901 Bytes
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
package main
import "testing"
func Test_GenerateRepoURL(t *testing.T) {
tests := []struct {
name string
args Args
org, repo string
expectedURL string
}{
{
name: "GitHub URL",
args: Args{
Enterprise: false,
},
org: "exampleOrg",
repo: "exampleRepo",
expectedURL: "https://github.com/exampleOrg/exampleRepo.git",
},
{
name: "Enterprise URL",
args: Args{
Enterprise: true,
EnterpriseUrl: "https://enterprise.example.com",
},
org: "exampleOrg",
repo: "exampleRepo",
expectedURL: "https://enterprise.example.com/exampleOrg/exampleRepo.git",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
args = tt.args
got := GenerateRepoURL(tt.org, tt.repo)
if got != tt.expectedURL {
t.Errorf("generateRepoURL() = %v, want %v", got, tt.expectedURL)
}
})
}
}