gpu-compute-chain/x/colinear-core/keeper/next_auction_test.go

39 lines
924 B
Go
Raw Normal View History

package keeper_test
import (
"testing"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/require"
keepertest "colinear/testutil/keeper"
"colinear/testutil/nullify"
"colinear/x/colinear-core/keeper"
"colinear/x/colinear-core/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.ColinearcoreKeeper(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.ColinearcoreKeeper(t)
createTestNextAuction(keeper, ctx)
keeper.RemoveNextAuction(ctx)
_, found := keeper.GetNextAuction(ctx)
require.False(t, found)
}