-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathaccount_test.go
73 lines (68 loc) · 1.85 KB
/
account_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 TestAccount_ChargeURL(t *testing.T) {
type fields struct {
ChargeAccountURL string
}
tests := []struct {
name string
fields fields
want string
}{
{
name: "returns the ChargeAccountURL in the account object if present",
fields: fields{"https://charge.account.url"},
want: "https://charge.account.url",
},
{
name: "set's the object ChargeAccountURL to config's defaultChargeURL and returns it",
want: baseURL + defaultChargeURL,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
a := &Account{
ChargeAccountURL: tt.fields.ChargeAccountURL,
}
if got := a.ChargeURL(); got != tt.want {
t.Errorf("Account.ChargeURL() = %v, want %v", got, tt.want)
}
if a.ChargeAccountURL != tt.want {
t.Errorf("Account.ChargeURL() = %v, want %v", a.ChargeAccountURL, tt.want)
}
})
}
}
func TestAccount_ValidateChargeURL(t *testing.T) {
type fields struct {
ValidateAccountChargeURL string
}
tests := []struct {
name string
fields fields
want string
}{
{
name: "returns ValidateAccountChargeURL in the account object if present",
fields: fields{"https://validate.account.charge.url"},
want: "https://validate.account.charge.url",
},
{
name: "set's the object ValidateAccountChargeURL to the config validateAccountChargeURL and returns it",
want: baseURL + validateAccountChargeURL,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
a := &Account{
ValidateAccountChargeURL: tt.fields.ValidateAccountChargeURL,
}
if got := a.ValidateChargeURL(); got != tt.want {
t.Errorf("Account.ValidateChargeURL() = %v, want %v", got, tt.want)
}
if a.ValidateAccountChargeURL != tt.want {
t.Errorf("Account.ValidateChargeURL() = %v, want %v", a.ValidateAccountChargeURL, tt.want)
}
})
}
}