-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
100 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package keeper_test | ||
|
||
import "github.com/terra-money/core/v2/x/tokenfactory/types" | ||
|
||
func (s *KeeperTestSuite) TestQueryParams() { | ||
params, err := s.App.TokenFactoryKeeper.Params(s.Ctx, &types.QueryParamsRequest{}) | ||
|
||
s.Require().NoError(err) | ||
|
||
expected := types.QueryParamsResponse{ | ||
Params: s.App.TokenFactoryKeeper.GetParams(s.Ctx), | ||
} | ||
s.Require().Equal(&expected, params) | ||
|
||
} | ||
|
||
func (s *KeeperTestSuite) TestQueryBeforeSendHookEmptyAddress() { | ||
res, err := s.App.TokenFactoryKeeper.BeforeSendHookAddress(s.Ctx, &types.QueryBeforeSendHookAddressRequest{}) | ||
|
||
s.Require().NoError(err) | ||
|
||
expected := types.QueryBeforeSendHookAddressResponse{ | ||
CosmwasmAddress: "", | ||
} | ||
s.Require().Equal(&expected, res) | ||
|
||
} | ||
|
||
func (s *KeeperTestSuite) TestQueryBeforeSendHookNonRegisteredAddress() { | ||
res, err := s.App.TokenFactoryKeeper.BeforeSendHookAddress(s.Ctx, &types.QueryBeforeSendHookAddressRequest{ | ||
Denom: "bitcoin", | ||
}) | ||
s.Require().NoError(err) | ||
|
||
expected := types.QueryBeforeSendHookAddressResponse{ | ||
CosmwasmAddress: "", | ||
} | ||
s.Require().Equal(&expected, res) | ||
|
||
} |
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,19 @@ | ||
package types_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/terra-money/core/v2/x/tokenfactory/types" | ||
) | ||
|
||
func TestKeys(t *testing.T) { | ||
denom_key := types.GetDenomPrefixStore("denom") | ||
creator_key := types.GetCreatorPrefix("creator") | ||
creator_prefix_key := types.GetCreatorsPrefix() | ||
|
||
require.Equal(t, []byte("denoms|denom|"), denom_key) | ||
require.Equal(t, []byte("creator|creator|"), creator_key) | ||
require.Equal(t, []byte("creator|"), creator_prefix_key) | ||
} |
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,27 @@ | ||
package types_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"cosmossdk.io/math" | ||
"github.com/stretchr/testify/require" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/terra-money/core/v2/x/tokenfactory/types" | ||
) | ||
|
||
func TestCreateNewParms(t *testing.T) { | ||
// Creaate new params | ||
params := types.NewParams(sdk.NewCoins(sdk.NewCoin("uluna", math.NewInt(100000))), 10) | ||
new_expected_params := types.Params{ | ||
DenomCreationFee: sdk.NewCoins(sdk.NewCoin("uluna", math.NewInt(100000))), | ||
DenomCreationGasConsume: 10, | ||
} | ||
require.Equal(t, new_expected_params, params) | ||
|
||
// Validate params set creation and validate they are different than the default | ||
paramSetPairs := params.ParamSetPairs() | ||
require.Equal(t, 2, len(paramSetPairs)) | ||
defaultKeyTable := types.ParamKeyTable() | ||
require.NotEqual(t, defaultKeyTable, paramSetPairs) | ||
} |