Skip to content

Commit c3541e3

Browse files
Re-instated removed test
Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
1 parent 67dc17f commit c3541e3

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

pkg/fftypes/enum_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,33 @@
1717
package fftypes
1818

1919
import (
20+
"database/sql/driver"
21+
"encoding/json"
2022
"testing"
2123

2224
"github.com/stretchr/testify/assert"
2325
)
2426

27+
func TestFFEnumStringCompareEtc(t *testing.T) {
28+
29+
txtype1 := TransactionType("Batch_Pin")
30+
assert.True(t, TransactionTypeBatchPin.Equals(txtype1))
31+
assert.Equal(t, TransactionTypeBatchPin, txtype1.Lower())
32+
33+
var tdv driver.Valuer = txtype1
34+
v, err := tdv.Value()
35+
assert.Nil(t, err)
36+
assert.Equal(t, "batch_pin", v)
37+
38+
var utStruct struct {
39+
TXType TransactionType `json:"txType"`
40+
}
41+
err = json.Unmarshal([]byte(`{"txType": "Batch_PIN"}`), &utStruct)
42+
assert.NoError(t, err)
43+
assert.Equal(t, "batch_pin", string(utStruct.TXType))
44+
45+
}
46+
2547
func TestFFEnumValues(t *testing.T) {
2648
assert.Equal(t, FFEnum("test1"), ffEnum("ut", "test1"))
2749
assert.Equal(t, FFEnum("test2"), ffEnum("ut", "test2"))

0 commit comments

Comments
 (0)