From a8e79465192dc74d298600840af492815b9a2588 Mon Sep 17 00:00:00 2001 From: Techno Freak Date: Fri, 21 Jul 2023 13:55:16 +0300 Subject: [PATCH] chore: added tests --- pkg/utils/utils_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/pkg/utils/utils_test.go b/pkg/utils/utils_test.go index 042ea22..737cdac 100644 --- a/pkg/utils/utils_test.go +++ b/pkg/utils/utils_test.go @@ -183,3 +183,29 @@ func TestSplitStringIntoChunksMoreChunks(t *testing.T) { chunks := SplitStringIntoChunks(str, 10) assert.Len(t, chunks, 3, "There should be 3 chunks!") } + +func TestConvertBech32PrefixInvalid(t *testing.T) { + t.Parallel() + + _, err := ConvertBech32Prefix( + "test", + "cosmosvaloper", + ) + assert.NotNil(t, err, "Error should be present!") +} + +func TestConvertBech32PrefixValid(t *testing.T) { + t.Parallel() + + address, err := ConvertBech32Prefix( + "cosmos1xqz9pemz5e5zycaa89kys5aw6m8rhgsvtp9lt2", + "cosmosvaloper", + ) + assert.Nil(t, err, "Error should not be present!") + assert.Equal( + t, + address, + "cosmosvaloper1xqz9pemz5e5zycaa89kys5aw6m8rhgsvw4328e", + "Bech addresses should not be equal!", + ) +}