File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 1717package fftypes
1818
1919import (
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+
2547func TestFFEnumValues (t * testing.T ) {
2648 assert .Equal (t , FFEnum ("test1" ), ffEnum ("ut" , "test1" ))
2749 assert .Equal (t , FFEnum ("test2" ), ffEnum ("ut" , "test2" ))
You can’t perform that action at this time.
0 commit comments