prysm-pulse/beacon-chain/rpc/debug/forkchoice_test.go
Preston Van Loon eb694ab5d5
Update rules_go and fix proto conflicts (#8596)
* Update rules_go and fix proto conflicts

* gaz

* Update generated code

* more emptypb fixes

* gaz

Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
2021-03-11 18:03:19 -06:00

23 lines
898 B
Go

package debug
import (
"context"
"testing"
"github.com/golang/protobuf/ptypes/empty"
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(), &empty.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")
}