-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcard_test.go
73 lines (68 loc) · 1.75 KB
/
card_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
63
64
65
66
67
68
69
70
71
72
73
package ravepay
import "testing"
func TestCard_ChargeURL(t *testing.T) {
type fields struct {
ChargeCardURL string
}
tests := []struct {
name string
fields fields
want string
}{
{
name: "returns the ChargeCardURL in the card object if present",
fields: fields{"https://charge.card.url"},
want: "https://charge.card.url",
},
{
name: "set's the object ChargeCardURL to config's defaultChargeURL and returns it",
want: baseURL + defaultChargeURL,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
c := &Card{
ChargeCardURL: tt.fields.ChargeCardURL,
}
if got := c.ChargeURL(); got != tt.want {
t.Errorf("Card.ChargeURL() = %v, want %v", got, tt.want)
}
if c.ChargeCardURL != tt.want {
t.Errorf("Card.ChargeURL() = %v, want %v", c.ChargeCardURL, tt.want)
}
})
}
}
func TestCard_ValidateChargeURL(t *testing.T) {
type fields struct {
ValidateCardChargeURL string
}
tests := []struct {
name string
fields fields
want string
}{
{
name: "returns ValidateCardChargeURL in card object if present",
fields: fields{"https://validate.card.charge.url"},
want: "https://validate.card.charge.url",
},
{
name: "set's the object ValidateCardChargeURL to the config ValidateCardChargeURL and returns it",
want: baseURL + validateCardChargeURL,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
c := &Card{
ValidateCardChargeURL: tt.fields.ValidateCardChargeURL,
}
if got := c.ValidateChargeURL(); got != tt.want {
t.Errorf("Card.ValidateChargeURL() = %v, want %v", got, tt.want)
}
if c.ValidateCardChargeURL != tt.want {
t.Errorf("Card.ValidateChargeURL() = %v, want %v", c.ValidateCardChargeURL, tt.want)
}
})
}
}