-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib_test.go
120 lines (112 loc) · 2.4 KB
/
lib_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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
package main
import (
"testing"
)
func Test_createInvoice(t *testing.T) {
type args struct {
ciie CreateInvoiceInputEvent
}
tests := []struct {
name string
args args
wantErr bool
}{
//TODO: Add test cases.
{
name: "Basic",
args: args{
ciie: CreateInvoiceInputEvent{
CustomerEmail: "[email protected]",
CustomerId: "63863064",
Amount: 4000,
Currency: "NGN",
DueDate: "2022-02-15",
SendNotification: true,
Draft: true,
},
},
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
_, err := createInvoice(tt.args.ciie)
if (err != nil) != tt.wantErr {
t.Errorf("createInvoice() error = %v, wantErr %v", err, tt.wantErr)
return
}
})
}
}
func Test_createCustomerInvoice(t *testing.T) {
type args struct {
customerId string
ciie CreateInvoiceInputEvent
}
tests := []struct {
name string
args args
//want *paystack.Invoice
wantErr bool
}{
// TODO: Add test cases.
{
name: "Basic",
args: args{
customerId: "63863064",
ciie: CreateInvoiceInputEvent{
CustomerEmail: "[email protected]",
CustomerId: "63863064",
Amount: 4000,
Currency: "NGN",
DueDate: "2022-12-29",
SendNotification: false,
Draft: false,
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
_, err := createCustomerInvoice(tt.args.customerId, tt.args.ciie)
if (err != nil) != tt.wantErr {
t.Errorf("createCustomerInvoice() error = %v, wantErr %v", err, tt.wantErr)
return
}
})
}
}
func Test_getOrCreateCustomer(t *testing.T) {
type args struct {
customerId string
customerEmail string
}
tests := []struct {
name string
args args
//want string
wantErr bool
}{
// TODO: Add test cases.
{
name: "Basic",
args: args{
customerId: "",
customerEmail: "[email protected]",
},
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
_, err := getOrCreateCustomer(tt.args.customerId, tt.args.customerEmail)
if (err != nil) != tt.wantErr {
t.Errorf("getOrCreateCustomer() error = %v, wantErr %v", err, tt.wantErr)
return
}
// if got != tt.want {
// t.Errorf("getOrCreateCustomer() = %v, want %v", got, tt.want)
// }
})
}
}