-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathpaystack_test.go
56 lines (47 loc) · 1.12 KB
/
paystack_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
package paystack
import "testing"
var c *Client
func init() {
apiKey := mustGetTestKey()
c = NewClient(apiKey, nil)
}
func TestResolveCardBIN(t *testing.T) {
resp, err := c.ResolveCardBIN(59983)
if err != nil {
t.Error(err)
}
if _, ok := resp["bin"]; !ok {
t.Errorf("Expected response to contain bin")
}
}
func TestCheckBalance(t *testing.T) {
resp, err := c.CheckBalance()
if err != nil {
t.Error(err)
}
if _, ok := resp["currency"]; !ok {
t.Errorf("Expected response to contain currency")
}
if _, ok := resp["balance"]; !ok {
t.Errorf("Expected response to contain balance")
}
}
func TestSessionTimeout(t *testing.T) {
resp, err := c.GetSessionTimeout()
if err != nil {
t.Error(err)
}
if _, ok := resp["payment_session_timeout"]; !ok {
t.Errorf("Expected response to contain payment_session_timeout")
}
/*
// actual tests in the Paystack API console also fails. Likely a server error
resp, err = c.UpdateSessionTimeout(30)
if err != nil {
t.Error(err)
}
if _, ok := resp["payment_session_timeout"]; !ok {
t.Errorf("Expected response to contain payment_session_timeout")
}
*/
}