Skip to content

Commit

Permalink
Remove goconvey from internal/codes/main_test (#681)
Browse files Browse the repository at this point in the history
  • Loading branch information
Le Cheng Fan authored and bartekn committed Sep 24, 2018
1 parent 957c3d1 commit 924decb
Showing 1 changed file with 26 additions and 30 deletions.
56 changes: 26 additions & 30 deletions services/horizon/internal/codes/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,36 @@ package codes
import (
"testing"

. "github.com/smartystreets/goconvey/convey"
"github.com/stellar/go/xdr"
"github.com/stretchr/testify/assert"
)

func TestCodes(t *testing.T) {
Convey("codes.String", t, func() {
tests := []struct {
Input interface{}
Expected string
Err error
}{
{xdr.TransactionResultCodeTxSuccess, "tx_success", nil},
{xdr.OperationResultCodeOpBadAuth, "op_bad_auth", nil},
{xdr.CreateAccountResultCodeCreateAccountLowReserve, "op_low_reserve", nil},
{xdr.PaymentResultCodePaymentSrcNoTrust, "op_src_no_trust", nil},
{0, "", ErrUnknownCode},
}
func TestString(t *testing.T) {
tests := []struct {
Input interface{}
Expected string
Err error
}{
{xdr.TransactionResultCodeTxSuccess, "tx_success", nil},
{xdr.OperationResultCodeOpBadAuth, "op_bad_auth", nil},
{xdr.CreateAccountResultCodeCreateAccountLowReserve, "op_low_reserve", nil},
{xdr.PaymentResultCodePaymentSrcNoTrust, "op_src_no_trust", nil},
{0, "", ErrUnknownCode},
}

for _, test := range tests {
actual, err := String(test.Input)
for _, test := range tests {
actual, err := String(test.Input)

if test.Err != nil {
So(err, ShouldNotBeNil)
So(err.Error(), ShouldEqual, test.Err.Error())
} else {
So(err, ShouldBeNil)
So(actual, ShouldEqual, test.Expected)
}
if test.Err != nil {
assert.NotNil(t, err)
assert.Equal(t, test.Err.Error(), err.Error())
} else {
assert.Nil(t, err)
assert.Equal(t, test.Expected, actual)
}
})

Convey("codes.ForOperationResult", t, func() {
//TODO: op_inner refers to inner result code
//TODO: non op_inner uses the outer result code
//TODO: one test for each operation type
})
}
}

//TODO: op_inner refers to inner result code
//TODO: non op_inner uses the outer result code
//TODO: one test for each operation type

0 comments on commit 924decb

Please sign in to comment.