mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-24 09:25:21 +00:00
40 lines
755 B
Go
40 lines
755 B
Go
package network
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/anthdm/neo-go/pkg/network/payload"
|
|
)
|
|
|
|
func TestHandleVersion(t *testing.T) {
|
|
s := NewServer(ModeDevNet)
|
|
go s.loop()
|
|
|
|
p := NewLocalPeer(s)
|
|
|
|
version := payload.NewVersion(1337, p.addr().Port, "/NEO:0.0.0/", 0, true)
|
|
msg := newMessage(ModeDevNet, cmdVersion, version)
|
|
|
|
resp := s.handleVersionCmd(msg, p)
|
|
if resp.commandType() != cmdVerack {
|
|
t.Fatalf("expected response message to be verack got %s", resp.commandType())
|
|
}
|
|
if resp.Payload != nil {
|
|
t.Fatal("verack payload should be nil")
|
|
}
|
|
}
|
|
|
|
func TestHandleAddrCmd(t *testing.T) {
|
|
// todo
|
|
}
|
|
|
|
func TestHandleGetAddrCmd(t *testing.T) {
|
|
// todo
|
|
}
|
|
|
|
func TestHandleInv(t *testing.T) {
|
|
// todo
|
|
}
|
|
func TestHandleBlockCmd(t *testing.T) {
|
|
// todo
|
|
}
|