2020-05-26 23:24:38 +00:00
|
|
|
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"
|
2020-07-20 02:15:51 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
|
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
2020-05-26 23:24:38 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestServer_GetForkChoice(t *testing.T) {
|
2020-08-08 01:37:08 +00:00
|
|
|
store := &protoarray.Store{}
|
|
|
|
bs := &Server{HeadFetcher: &mock.ChainService{ForkChoiceStore: store}}
|
2020-05-26 23:24:38 +00:00
|
|
|
res, err := bs.GetProtoArrayForkChoice(context.Background(), &ptypes.Empty{})
|
2020-07-20 02:15:51 +00:00
|
|
|
require.NoError(t, err)
|
2020-08-08 01:37:08 +00:00
|
|
|
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")
|
2020-05-26 23:24:38 +00:00
|
|
|
}
|