prysm-pulse/testing/spectest/shared/common/forkchoice/builder_test.go
Radosław Kapka 7f56ac6355
Massive code cleanup (#10913)
* Massive code cleanup

* fix test issues

* remove GetGenesis mock expectations

* unused receiver

* rename unused params

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2022-06-27 13:34:38 +00:00

42 lines
1.1 KiB
Go

package forkchoice
import (
"testing"
"github.com/prysmaticlabs/prysm/consensus-types/wrapper"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/testing/require"
"github.com/prysmaticlabs/prysm/testing/util"
)
func TestBuilderTick(t *testing.T) {
st, err := util.NewBeaconState()
require.NoError(t, err)
blk, err := wrapper.WrappedSignedBeaconBlock(util.NewBeaconBlock())
require.NoError(t, err)
builder := NewBuilder(t, st, blk)
builder.Tick(t, 10)
require.Equal(t, int64(10), builder.lastTick)
}
func TestBuilderInvalidBlock(t *testing.T) {
st, err := util.NewBeaconState()
require.NoError(t, err)
blk, err := wrapper.WrappedSignedBeaconBlock(util.NewBeaconBlock())
require.NoError(t, err)
builder := NewBuilder(t, st, blk)
builder.InvalidBlock(t, blk)
}
func TestPoWBlock(t *testing.T) {
st, err := util.NewBeaconState()
require.NoError(t, err)
blk, err := wrapper.WrappedSignedBeaconBlock(util.NewBeaconBlock())
require.NoError(t, err)
builder := NewBuilder(t, st, blk)
builder.PoWBlock(&ethpb.PowBlock{BlockHash: []byte{1, 2, 3}})
require.Equal(t, 1, len(builder.execMock.powBlocks))
}