-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…16313) Co-authored-by: Julien Robert <julien@rbrt.fr>
- Loading branch information
1 parent
41a32fe
commit 40622ff
Showing
3 changed files
with
53 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package client_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestValidatePromptNotEmpty(t *testing.T) { | ||
require := require.New(t) | ||
|
||
require.NoError(client.ValidatePromptNotEmpty("foo")) | ||
require.ErrorContains(client.ValidatePromptNotEmpty(""), "input cannot be empty") | ||
} | ||
|
||
func TestValidatePromptURL(t *testing.T) { | ||
require := require.New(t) | ||
|
||
require.NoError(client.ValidatePromptURL("https://example.com")) | ||
require.ErrorContains(client.ValidatePromptURL("foo"), "invalid URL") | ||
} | ||
|
||
func TestValidatePromptAddress(t *testing.T) { | ||
require := require.New(t) | ||
|
||
require.NoError(client.ValidatePromptAddress("cosmos1huydeevpz37sd9snkgul6070mstupukw00xkw9")) | ||
require.NoError(client.ValidatePromptAddress("cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0")) | ||
require.NoError(client.ValidatePromptAddress("cosmosvalcons1ntk8eualewuprz0gamh8hnvcem2nrcdsgz563h")) | ||
require.ErrorContains(client.ValidatePromptAddress("foo"), "invalid address") | ||
} | ||
|
||
func TestValidatePromptCoins(t *testing.T) { | ||
require := require.New(t) | ||
|
||
require.NoError(client.ValidatePromptCoins("100stake")) | ||
require.ErrorContains(client.ValidatePromptCoins("foo"), "invalid coins") | ||
} |