-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers_test.go
62 lines (56 loc) · 1.43 KB
/
helpers_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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package zube
import (
"reflect"
"testing"
"github.com/platogo/zube/v2/models"
)
func TestGetMembersByNames(t *testing.T) {
type args struct {
names []string
members []models.Member
}
members := []models.Member{
{Person: models.Person{Name: "dan"}},
{Person: models.Person{Name: "pete"}},
{Person: models.Person{Name: "john"}},
}
tests := []struct {
name string
args args
want []models.Member
}{
{"check returns members for given names", args{[]string{"dan", "pete"}, members}, []models.Member{
{Person: models.Person{Name: "dan"}},
{Person: models.Person{Name: "pete"}}}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := GetMembersByNames(tt.args.names, tt.args.members); !reflect.DeepEqual(got, tt.want) {
t.Errorf("GetMembersByNames() = %v, want %v", got, tt.want)
}
})
}
}
func TestCardUrl(t *testing.T) {
type args struct {
account *models.Account
project *models.Project
card *models.Card
}
tests := []struct {
name string
args args
want string
}{
{"check that returns correct url",
args{&models.Account{Slug: "platogo"}, &models.Project{Slug: "server"}, &models.Card{Number: 1234}},
"https://zube.io/platogo/server/c/1234"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := CardUrl(tt.args.account, tt.args.project, tt.args.card); got != tt.want {
t.Errorf("CardUrl() = %v, want %v", got, tt.want)
}
})
}
}