prysm-pulse/beacon-chain/rpc/debug/forkchoice_test.go
terence tsao cca439847d
Unexport protoarray forkchoice types (#6937)
* Protoarray: un-export all the types

* Protoarray: add proper getters

* Protoarray: update implementations

* Protoarray: update tests

* Protoarray: lint

* Protoarray: lint
2020-08-07 18:37:08 -07:00

23 lines
897 B
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{}
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")
}