forked from stripe/stripe-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbankaccount_test.go
48 lines (41 loc) · 1.38 KB
/
bankaccount_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
package stripe
import (
"testing"
assert "github.com/stretchr/testify/require"
"github.com/stripe/stripe-go/form"
)
func TestBankAccountParams_AppendToAsSourceOrExternalAccount(t *testing.T) {
// We should add more tests for all the various corner cases here ...
// Includes account_holder_name
{
params := &BankAccountParams{AccountHolderName: "Tyrion"}
body := &form.Values{}
params.AppendToAsSourceOrExternalAccount(body)
t.Logf("body = %+v", body)
assert.Equal(t, []string{"Tyrion"}, body.Get("external_account[account_holder_name]"))
}
// Does not include account_holder_name if empty
{
params := &BankAccountParams{}
body := &form.Values{}
params.AppendToAsSourceOrExternalAccount(body)
t.Logf("body = %+v", body)
assert.Equal(t, []string(nil), body.Get("external_account[account_holder_name]"))
}
// Includes account_holder_name
{
params := &BankAccountParams{AccountHolderType: "individual"}
body := &form.Values{}
params.AppendToAsSourceOrExternalAccount(body)
t.Logf("body = %+v", body)
assert.Equal(t, []string{"individual"}, body.Get("external_account[account_holder_type]"))
}
// Does not include account_holder_name if empty
{
params := &BankAccountParams{}
body := &form.Values{}
params.AppendToAsSourceOrExternalAccount(body)
t.Logf("body = %+v", body)
assert.Equal(t, []string(nil), body.Get("external_account[account_holder_type]"))
}
}