Merge pull request #200 from harmony-one/open_source_cleanup

add test for api/client
pull/202/head
Leo Chen 6 years ago committed by GitHub
commit 0cbbc187e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      api/client/client_test.go

@ -0,0 +1,24 @@
package client
import (
"reflect"
"testing"
"github.com/harmony-one/harmony/p2p"
)
func TestClient(t *testing.T) {
leaders := map[uint32]p2p.Peer{
0: p2p.Peer{
IP: "127.0.0.1",
Port: "90",
},
}
client := NewClient(nil, &leaders)
leadersGot := client.GetLeaders()
if len(leadersGot) != 1 || !reflect.DeepEqual(leaders[0], leadersGot[0]) {
t.Errorf("expected: %v, got: %v\n", leaders[0], leadersGot[0])
}
}
Loading…
Cancel
Save