gpu-compute-chain/x/colinearcore/genesis_test.go

48 lines
1.1 KiB
Go
Raw Normal View History

package colinearcore_test
2022-08-25 16:51:14 -07:00
import (
"testing"
keepertest "colinear/testutil/keeper"
"colinear/testutil/nullify"
2022-09-06 15:18:09 -07:00
colinear "colinear/x/colinearcore"
"colinear/x/colinearcore/types"
2022-08-25 16:53:47 -07:00
2022-08-25 16:51:14 -07:00
"github.com/stretchr/testify/require"
)
func TestGenesis(t *testing.T) {
genesisState := types.GenesisState{
Params: types.DefaultParams(),
NextAuction: &types.NextAuction{
AuctionId: 43,
},
AuctionList: []types.Auction{
{
Index: "0",
},
{
Index: "1",
},
},
2022-09-07 13:25:57 -07:00
LockedUsers: &types.LockedUsers{
Users: map[string]string{},
},
2022-08-25 16:51:14 -07:00
// this line is used by starport scaffolding # genesis/test/state
}
k, ctx := keepertest.ColinearcoreKeeper(t)
colinear.InitGenesis(ctx, *k, genesisState)
got := colinear.ExportGenesis(ctx, *k)
2022-08-25 16:51:14 -07:00
require.NotNil(t, got)
nullify.Fill(&genesisState)
nullify.Fill(got)
require.Equal(t, genesisState.NextAuction, got.NextAuction)
require.ElementsMatch(t, genesisState.AuctionList, got.AuctionList)
2022-09-07 13:25:57 -07:00
require.Equal(t, genesisState.LockedUsers, got.LockedUsers)
2022-08-25 16:51:14 -07:00
// this line is used by starport scaffolding # genesis/test/assert
}