Skip to content

Commit a73a280

Browse files
committed
increase UT Coverage to 100%
1 parent 9430bb3 commit a73a280

File tree

6 files changed

+37
-6
lines changed

6 files changed

+37
-6
lines changed

gateway/midtrans/midtrans.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func createChargeMidtrans(params interface{}, opts *pg.Options) (*midtrans, erro
4747
}
4848

4949
// validation parameters
50-
err := validationParams(params)
50+
err := ValidationParams(params)
5151
if err != nil {
5252
return nil, err
5353
}

gateway/midtrans/validation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
"github.com/retgits/creditcard"
1010
)
1111

12-
// validationParams required for any payment method
13-
func validationParams(params interface{}) error {
12+
// ValidationParams required for any payment method
13+
func ValidationParams(params interface{}) error {
1414
switch params.(type) {
1515
case *EWallet:
1616
return validationEWallet(params.(*EWallet))

gateway/midtrans/validation_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package midtrans_test
2+
3+
import (
4+
"testing"
5+
6+
"github.com/pandudpn/go-payment-gateway/gateway/midtrans"
7+
"github.com/stretchr/testify/assert"
8+
)
9+
10+
func TestValidationParams_ErrorUnimplemented(t *testing.T) {
11+
var ab []byte
12+
13+
err := midtrans.ValidationParams(ab)
14+
assert.NotNil(t, err, "error should not to be nil")
15+
}

gateway/xendit/validation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ func validationPhoneNumberCustomer(country, phone string) bool {
2525
return phoneRegex.MatchString(phone)
2626
}
2727

28-
// validationParams required for any payment method
29-
func validationParams(params interface{}) error {
28+
// ValidationParams required for any payment method
29+
func ValidationParams(params interface{}) error {
3030
switch params.(type) {
3131
case *EWallet:
3232
return validationEWallet(params.(*EWallet))

gateway/xendit/validation_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package xendit_test
2+
3+
import (
4+
"testing"
5+
6+
"github.com/pandudpn/go-payment-gateway/gateway/xendit"
7+
"github.com/stretchr/testify/assert"
8+
)
9+
10+
func TestValidationParams_ErrorUnimplemented(t *testing.T) {
11+
var ab []byte
12+
13+
err := xendit.ValidationParams(ab)
14+
15+
assert.NotNil(t, err, "error should to be nil")
16+
}

gateway/xendit/xendit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func createChargeXendit(params interface{}, opts *pg.Options) (*xendit, error) {
3737
}
3838

3939
// validation parameters
40-
err := validationParams(params)
40+
err := ValidationParams(params)
4141
if err != nil {
4242
return nil, err
4343
}

0 commit comments

Comments
 (0)