forked from OutSystems/cloud-connector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_test.go
37 lines (34 loc) · 779 Bytes
/
main_test.go
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
package main
import "testing"
func Test_validateRemotes(t *testing.T) {
tests := []struct {
name string
remotes []string
want string
wantErr bool
}{
{
name: "success",
remotes: []string{"R:15800:localhost:7000", "R:15801:localhost:7001"},
want: "15800,15801",
wantErr: false,
},
{
name: "error",
remotes: []string{"R:15800:localhost:7000", "R:15800:localhost:7001"},
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := validateRemotes(tt.remotes)
if (err != nil) != tt.wantErr {
t.Errorf("validateRemotes() error = %v, wantErr %v", err, tt.wantErr)
return
}
if got != tt.want {
t.Errorf("validateRemotes() = %v, want %v", got, tt.want)
}
})
}
}