mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-28 14:17:17 +00:00
10d3275638
* applies assertion funcs to beacon-chain/rpc tests * Merge branch 'master' into rpc-apply-testutils-assertions * applies assertion funcs to beacon-chain/rpc/beacon tests * Merge branch 'master' into rpc-apply-testutils-assertions * applies assertion funcs to beacon-chain/rpc/debug tests * applies assertion funcs to beacon-chain/rpc/validator tests * Merge branch 'master' into rpc-apply-testutils-assertions * Merge refs/heads/master into rpc-apply-testutils-assertions
33 lines
1.1 KiB
Go
33 lines
1.1 KiB
Go
package debug
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
ptypes "github.com/gogo/protobuf/types"
|
|
mock "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing"
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/forkchoice/protoarray"
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
|
)
|
|
|
|
func TestServer_GetForkChoice(t *testing.T) {
|
|
store := &protoarray.Store{
|
|
PruneThreshold: 1,
|
|
JustifiedEpoch: 2,
|
|
FinalizedEpoch: 3,
|
|
Nodes: []*protoarray.Node{{Slot: 4, Root: [32]byte{'a'}}},
|
|
}
|
|
|
|
bs := &Server{
|
|
HeadFetcher: &mock.ChainService{ForkChoiceStore: store},
|
|
}
|
|
|
|
res, err := bs.GetProtoArrayForkChoice(context.Background(), &ptypes.Empty{})
|
|
require.NoError(t, err)
|
|
assert.Equal(t, store.PruneThreshold, res.PruneThreshold, "Did not get wanted prune threshold")
|
|
assert.Equal(t, store.JustifiedEpoch, res.JustifiedEpoch, "Did not get wanted justified epoch")
|
|
assert.Equal(t, store.FinalizedEpoch, res.FinalizedEpoch, "Did not get wanted finalized epoch")
|
|
assert.Equal(t, store.Nodes[0].Slot, res.ProtoArrayNodes[0].Slot, "Did not get wanted node slot")
|
|
}
|