mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-11 04:00:05 +00:00
7f41b69281
* Add ssz.HashRoot interface composition to BeaconBlock interface, move fork specific logic into it's own files * Remove needless underscore
46 lines
892 B
Go
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)
|
|
}
|
|
})
|
|
}
|
|
}
|