prysm-pulse/proto/prysm/v1alpha1/wrapper/beacon_block_test.go
Preston Van Loon 7f41b69281
Wrapper: Update block interface and reorganize fork logic (#10267)
* Add ssz.HashRoot interface composition to BeaconBlock interface, move fork specific logic into it's own files

* Remove needless underscore
2022-02-20 20:53:05 +00:00

46 lines
892 B
Go

package wrapper_test
import (
"testing"
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper"
"github.com/prysmaticlabs/prysm/testing/require"
"github.com/prysmaticlabs/prysm/testing/util"
)
func TestWrappedSignedBeaconBlock(t *testing.T) {
tests := []struct {
name string
blk interface{}
wantErr bool
}{
{
name: "unsupported type",
blk: "not a beacon block",
wantErr: true,
},
{
name: "phase0",
blk: util.NewBeaconBlock(),
},
{
name: "altair",
blk: util.NewBeaconBlockAltair(),
},
{
name: "bellatrix",
blk: util.NewBeaconBlockBellatrix(),
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
_, err := wrapper.WrappedSignedBeaconBlock(tt.blk)
if tt.wantErr {
require.ErrorIs(t, err, wrapper.ErrUnsupportedSignedBeaconBlock)
} else {
require.NoError(t, err)
}
})
}
}