gpu-compute-chain/x/cosmostest/keeper/next_auction_test.go

39 lines
926 B
Go

package keeper_test
import (
"testing"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/require"
keepertest "cosmos-test/testutil/keeper"
"cosmos-test/testutil/nullify"
"cosmos-test/x/cosmostest/keeper"
"cosmos-test/x/cosmostest/types"
)
func createTestNextAuction(keeper *keeper.Keeper, ctx sdk.Context) types.NextAuction {
item := types.NextAuction{}
keeper.SetNextAuction(ctx, item)
return item
}
func TestNextAuctionGet(t *testing.T) {
keeper, ctx := keepertest.CosmostestKeeper(t)
item := createTestNextAuction(keeper, ctx)
rst, found := keeper.GetNextAuction(ctx)
require.True(t, found)
require.Equal(t,
nullify.Fill(&item),
nullify.Fill(&rst),
)
}
func TestNextAuctionRemove(t *testing.T) {
keeper, ctx := keepertest.CosmostestKeeper(t)
createTestNextAuction(keeper, ctx)
keeper.RemoveNextAuction(ctx)
_, found := keeper.GetNextAuction(ctx)
require.False(t, found)
}