github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/x/erc20/types/types_test.go (about)

     1  package types
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  )
     8  
     9  const IbcDenom = "ibc/ddcd907790b8aa2bf9b2b3b614718fa66bfc7540e832ce3e3696ea717dceff49"
    10  
    11  func Test_IsValidIBCDenom(t *testing.T) {
    12  	tests := []struct {
    13  		name    string
    14  		denom   string
    15  		success bool
    16  	}{
    17  		{"wrong length", "ibc/6B5A664BF0AF4F71B2F0BAA33141E2F1321242FBD", false},
    18  		{"invalid denom", "aaa/6B5A664BF0AF4F71B2F0BAA33141E2F1321242FBD5D19762F541EC971ACB0865", false},
    19  		{"correct IBC denom", IbcDenom, true},
    20  	}
    21  	for _, tt := range tests {
    22  		tt := tt
    23  		t.Run(tt.name, func(t *testing.T) {
    24  			require.Equal(t, tt.success, IsValidIBCDenom(tt.denom))
    25  		})
    26  	}
    27  }