github.com/ChainSafe/chainbridge-core@v1.4.2/chains/evm/cli/centrifuge/centrifuge_test.go (about) 1 package centrifuge 2 3 import ( 4 "testing" 5 6 "github.com/spf13/cobra" 7 "github.com/stretchr/testify/suite" 8 ) 9 10 var ( 11 validAddr = "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EB66" 12 invalidAddr = "0xd606A00c1A39dA53EA7Bb3Ab570BBE40b156EXYZ" 13 ) 14 15 type CentrifugeTestSuite struct { 16 suite.Suite 17 } 18 19 func TestCentrifugeTestSuite(t *testing.T) { 20 suite.Run(t, new(CentrifugeTestSuite)) 21 } 22 23 func (s *CentrifugeTestSuite) SetupSuite() { 24 } 25 func (s *CentrifugeTestSuite) TearDownSuite() {} 26 27 func (s *CentrifugeTestSuite) TearDownTest() {} 28 29 func (s *CentrifugeTestSuite) TestValidateGetHashFlags() { 30 cmd := new(cobra.Command) 31 BindGetHashFlags(cmd) 32 33 err := cmd.Flag("address").Value.Set(validAddr) 34 s.Nil(err) 35 36 err = ValidateGetHashFlags( 37 cmd, 38 []string{}, 39 ) 40 s.Nil(err) 41 } 42 43 func (s *CentrifugeTestSuite) TestValidateGetHashInvalidAddress() { 44 cmd := new(cobra.Command) 45 BindGetHashFlags(cmd) 46 47 err := cmd.Flag("address").Value.Set(invalidAddr) 48 s.Nil(err) 49 50 err = ValidateGetHashFlags( 51 cmd, 52 []string{}, 53 ) 54 s.NotNil(err) 55 }