The core protocol of WoopChain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
woop/internal/newnode/newnode_test.go

40 lines
819 B

package newnode
6 years ago
import (
"testing"
beaconchain "github.com/harmony-one/harmony/internal/beaconchain/libs"
"github.com/harmony-one/harmony/p2p"
)
func TestNewNode(t *testing.T) {
var ip, port string
ip = "127.0.0.1"
port = "8080"
nnode := New(ip, port)
if nnode.PubK == nil {
t.Error("new node public key not initialized")
}
if nnode.SetInfo {
t.Error("new node setinfo initialized to true! (should be false)")
}
}
6 years ago
func TestBeaconChainConnect(t *testing.T) {
var ip, beaconport, nodeport string
ip = "127.0.0.1"
beaconport = "8080"
nodeport = "8081"
nnode := New(ip, nodeport)
bc := beaconchain.New(1, ip, beaconport)
go bc.StartServer()
BCPeer := p2p.Peer{IP: ip, Port: beaconport}
err := nnode.ContactBeaconChain(BCPeer)
if err != nil {
t.Error("could not read from connection")
}
}