Skip to content

Commit

Permalink
add small tests
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Nov 2, 2023
1 parent 2900aa0 commit e54a39d
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions x/tx/signing/aminojson/options_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package aminojson

import (
"testing"

"github.com/stretchr/testify/require"

"cosmossdk.io/x/tx/signing/aminojson/internal/testpb"
)

func Test_getMessageAminoName(t *testing.T) {
msg := &testpb.ABitOfEverything{}
name, ok := getMessageAminoName(msg.ProtoReflect())
require.True(t, ok)
require.Equal(t, "ABitOfEverything", name)

secondMsg := &testpb.Duration{}
_, ok = getMessageAminoName(secondMsg.ProtoReflect())
require.False(t, ok)
}

func Test_getMessageAminoNameAny(t *testing.T) {
msg := &testpb.ABitOfEverything{}
name := getMessageAminoNameAny(msg.ProtoReflect())
require.Equal(t, "ABitOfEverything", name)

secondMsg := &testpb.Duration{}
name = getMessageAminoNameAny(secondMsg.ProtoReflect())
require.Equal(t, "/testpb.Duration", name)
}

0 comments on commit e54a39d

Please sign in to comment.