-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from tellor-io/caleb-testing
Tested Mint Module
- Loading branch information
Showing
4 changed files
with
108 additions
and
25 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 |
---|---|---|
@@ -1,31 +1,105 @@ | ||
package keeper_test | ||
|
||
// import ( | ||
// "testing" | ||
import ( | ||
"testing" | ||
|
||
// "github.com/stretchr/testify/require" | ||
// keepertest "github.com/tellor-io/layer/testutil/keeper" | ||
// "github.com/tellor-io/layer/x/mint/types" | ||
// ) | ||
"github.com/stretchr/testify/suite" | ||
"github.com/tellor-io/layer/app/config" | ||
keepertest "github.com/tellor-io/layer/testutil/keeper" | ||
"github.com/tellor-io/layer/x/mint/keeper" | ||
"github.com/tellor-io/layer/x/mint/mocks" | ||
"github.com/tellor-io/layer/x/mint/types" | ||
|
||
// func TestNewKeeper(t *testing.T) { | ||
// } | ||
"cosmossdk.io/math" | ||
storetypes "cosmossdk.io/store/types" | ||
|
||
// func TestLogger(t *testing.T) { | ||
// } | ||
// func TestGetMinter(t *testing.T) { | ||
// } | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" | ||
auth "github.com/cosmos/cosmos-sdk/x/auth" | ||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" | ||
bank "github.com/cosmos/cosmos-sdk/x/bank" | ||
staking "github.com/cosmos/cosmos-sdk/x/staking" | ||
) | ||
|
||
// func TestSetMinter(t *testing.T) { | ||
// //checkAccess | ||
// } | ||
type KeeperTestSuite struct { | ||
suite.Suite | ||
|
||
// func TestMintCoins(t *testing.T) { | ||
// //checkAccess | ||
// } | ||
ctx sdk.Context | ||
mintKeeper keeper.Keeper | ||
accountKeeper *mocks.AccountKeeper | ||
bankKeeper *mocks.BankKeeper | ||
} | ||
|
||
// func TestSendCoinsToTeam(t *testing.T) { | ||
// } | ||
func (s *KeeperTestSuite) SetupTest() { | ||
config.SetupConfig() | ||
|
||
// func TestInflationaryRewards(t *testing.T) { | ||
// } | ||
s.mintKeeper, | ||
s.accountKeeper, | ||
s.bankKeeper, | ||
s.ctx = keepertest.MintKeeper(s.T()) | ||
} | ||
|
||
func (s *KeeperTestSuite) TestNewKeeper(t *testing.T) { | ||
s.SetupTest() | ||
|
||
s.accountKeeper.On("GetModuleAddress", types.ModuleName).Return(authtypes.NewModuleAddress(types.ModuleName)) | ||
s.accountKeeper.On("GetModuleAddress", types.MintToTeam).Return(authtypes.NewModuleAddress(types.MintToTeam)) | ||
s.accountKeeper.On("GetModuleAddress", types.TimeBasedRewards).Return(authtypes.NewModuleAddress(types.TimeBasedRewards)) | ||
|
||
appCodec := moduletestutil.MakeTestEncodingConfig(auth.AppModuleBasic{}, bank.AppModuleBasic{}, staking.AppModuleBasic{}).Codec | ||
keys := storetypes.NewKVStoreKeys(types.StoreKey) | ||
|
||
keeper := keeper.NewKeeper(appCodec, keys[types.StoreKey], s.accountKeeper, s.bankKeeper) | ||
s.NotNil(keeper) | ||
} | ||
|
||
func (s *KeeperTestSuite) TestLogger(t *testing.T) { | ||
s.SetupTest() | ||
|
||
logger := s.mintKeeper.Logger(s.ctx) | ||
s.NotNil(logger) | ||
} | ||
|
||
func (s *KeeperTestSuite) TestGetMinter(t *testing.T) { | ||
s.SetupTest() | ||
|
||
minter := s.mintKeeper.GetMinter(s.ctx) | ||
s.ctx.Logger().Info("Minter: %v", minter) | ||
|
||
s.NotNil(minter) | ||
s.Equal("loya", minter.BondDenom) | ||
} | ||
|
||
func (s *KeeperTestSuite) TestSetMinter(t *testing.T) { | ||
s.SetupTest() | ||
|
||
minter := types.NewMinter("loya") | ||
s.mintKeeper.SetMinter(s.ctx, minter) | ||
|
||
returnedMinter := s.mintKeeper.GetMinter(s.ctx) | ||
s.Equal(minter, returnedMinter) | ||
} | ||
|
||
func (s *KeeperTestSuite) TestMintCoins(t *testing.T) { | ||
s.SetupTest() | ||
coins := sdk.NewCoins(sdk.NewCoin("loya", math.NewInt(100*1e6))) | ||
|
||
err := s.mintKeeper.MintCoins(s.ctx, coins) | ||
s.NoError(err) | ||
} | ||
|
||
func (s *KeeperTestSuite) TestSendCoinsToTeam(t *testing.T) { | ||
s.SetupTest() | ||
coins := sdk.NewCoins(sdk.NewCoin("loya", math.NewInt(100*1e6))) | ||
|
||
err := s.mintKeeper.SendCoinsToTeam(s.ctx, coins) | ||
s.NoError(err) | ||
} | ||
|
||
func (s *KeeperTestSuite) TestInflationaryRewards(t *testing.T) { | ||
s.SetupTest() | ||
coins := sdk.NewCoins(sdk.NewCoin("loya", math.NewInt(100*1e6))) | ||
|
||
err := s.mintKeeper.SendInflationaryRewards(s.ctx, coins) | ||
s.NoError(err) | ||
} |
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