cosmos-sdk/client/keys/parse_test.go
mergify[bot] 2ad5ab913d
chore: bump golangci-lint and fix all linting issues (backport #21761) (#21779)
Co-authored-by: Julien Robert <julien@rbrt.fr>
2024-09-17 11:49:10 +00:00

29 lines
679 B
Go

package keys
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestParseKey(t *testing.T) {
bech32str := "cosmos104ytdpvrx9284zd50v9ep8c6j7pua7dkk0x3ek"
hexstr := "EB5AE9872103497EC092EF901027049E4F39200C60040D3562CD7F104A39F62E6E5A39A818F4"
tests := []struct {
name string
args []string
wantErr bool
}{
{"empty input", []string{""}, true},
{"invalid input", []string{"invalid"}, true},
{"bech32", []string{bech32str}, false},
{"hex", []string{hexstr}, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
require.Equal(t, tt.wantErr, doParseKey(ParseKeyStringCommand(), "cosmos", tt.args) != nil)
})
}
}