mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-06-03 04:36:41 +00:00
36 lines
970 B
Go
36 lines
970 B
Go
package keeper_test
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
keepertest "github.com/planetmint/planetmint-go/testutil/keeper"
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/planetmint/planetmint-go/x/dao/keeper"
|
|
"github.com/planetmint/planetmint-go/x/dao/types"
|
|
)
|
|
|
|
func createNReissuances(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Reissuance {
|
|
items := make([]types.Reissuance, n)
|
|
for i := range items {
|
|
items[i].BlockHeight = uint64(i)
|
|
items[i].Proposer = fmt.Sprintf("proposer_%v", i)
|
|
items[i].Rawtx = fmt.Sprintf("rawtransaction_%v", i)
|
|
items[i].TxId = ""
|
|
keeper.StoreReissuance(ctx, items[i])
|
|
}
|
|
return items
|
|
}
|
|
|
|
func TestGetReissuances(t *testing.T) {
|
|
keeper, ctx := keepertest.DaoKeeper(t)
|
|
items := createNReissuances(keeper, ctx, 10)
|
|
for _, item := range items {
|
|
reissuance, found := keeper.LookupReissuance(ctx, item.BlockHeight)
|
|
assert.True(t, found)
|
|
assert.Equal(t, item, reissuance)
|
|
}
|
|
}
|