39 lines
922 B
Go
39 lines
922 B
Go
|
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/colinearcore/keeper"
|
||
|
"colinear/x/colinearcore/types"
|
||
|
)
|
||
|
|
||
|
func createTestLockedUsers(keeper *keeper.Keeper, ctx sdk.Context) types.LockedUsers {
|
||
|
item := types.LockedUsers{}
|
||
|
keeper.SetLockedUsers(ctx, item)
|
||
|
return item
|
||
|
}
|
||
|
|
||
|
func TestLockedUsersGet(t *testing.T) {
|
||
|
keeper, ctx := keepertest.ColinearcoreKeeper(t)
|
||
|
item := createTestLockedUsers(keeper, ctx)
|
||
|
rst, found := keeper.GetLockedUsers(ctx)
|
||
|
require.True(t, found)
|
||
|
require.Equal(t,
|
||
|
nullify.Fill(&item),
|
||
|
nullify.Fill(&rst),
|
||
|
)
|
||
|
}
|
||
|
|
||
|
func TestLockedUsersRemove(t *testing.T) {
|
||
|
keeper, ctx := keepertest.ColinearcoreKeeper(t)
|
||
|
createTestLockedUsers(keeper, ctx)
|
||
|
keeper.RemoveLockedUsers(ctx)
|
||
|
_, found := keeper.GetLockedUsers(ctx)
|
||
|
require.False(t, found)
|
||
|
}
|