diff --git a/internal/beaconchain/libs/beaconchain_test.go b/internal/beaconchain/libs/beaconchain_test.go index ab5e2baf7..86df649d4 100644 --- a/internal/beaconchain/libs/beaconchain_test.go +++ b/internal/beaconchain/libs/beaconchain_test.go @@ -1,6 +1,13 @@ package beaconchain -import "testing" +import ( + "reflect" + "strconv" + "testing" + + proto "github.com/harmony-one/harmony/api/beaconchain" + beaconchain "github.com/harmony-one/harmony/internal/beaconchain/rpc" +) func TestNewNode(t *testing.T) { var ip, port string @@ -21,3 +28,20 @@ func TestNewNode(t *testing.T) { t.Error("beacon chain number of shards not initialized to given number of desired shards") } } + +func TestFetchLeaders(t *testing.T) { + var ip string + ip = "127.0.0.1" + beaconport := "8080" + numshards := 1 + bc := New(numshards, ip, beaconport) + bc.SupportRPC() + port, _ := strconv.Atoi(beaconport) + bcClient := beaconchain.NewClient("127.0.0.1", strconv.Itoa(port+BeaconchainServicePortDiff)) + response := bcClient.GetLeaders() + expresponse := &proto.FetchLeadersResponse{} + if !reflect.DeepEqual(response, expresponse) { + t.Error("was expexting a empty leaders array") + } + +}