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

39 lines
922 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"
2022-09-06 15:18:09 -07:00
"colinear/x/colinearcore/keeper"
"colinear/x/colinearcore/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)
}