mirror of https://github.com/vacp2p/nim-libp2p.git
readding missed tests
This commit is contained in:
parent
a0aaa29739
commit
1611d2b1c0
|
@ -37,31 +37,31 @@ proc newTestDecodeStream(): TestDecodeStream =
|
||||||
result.msg = fromHex("8801023137")
|
result.msg = fromHex("8801023137")
|
||||||
|
|
||||||
suite "Mplex":
|
suite "Mplex":
|
||||||
# test "encode header":
|
test "encode header":
|
||||||
# proc testEncodeHeader(): Future[bool] {.async.} =
|
proc testEncodeHeader(): Future[bool] {.async.} =
|
||||||
# proc encHandler(msg: seq[byte]) =
|
proc encHandler(msg: seq[byte]) =
|
||||||
# check msg == fromHex("880102")
|
check msg == fromHex("880102")
|
||||||
|
|
||||||
# let conn = newConnection(newTestEncodeStream(encHandler))
|
let conn = newConnection(newTestEncodeStream(encHandler))
|
||||||
# await conn.writeHeader(17, MessageType.New, 2)
|
await conn.writeHeader(17, MessageType.New, 2)
|
||||||
# result = true
|
result = true
|
||||||
|
|
||||||
# check:
|
check:
|
||||||
# waitFor(testEncodeHeader()) == true
|
waitFor(testEncodeHeader()) == true
|
||||||
|
|
||||||
# test "decode header":
|
test "decode header":
|
||||||
# proc testDecodeHeader(): Future[bool] {.async.} =
|
proc testDecodeHeader(): Future[bool] {.async.} =
|
||||||
# let conn = newConnection(newTestDecodeStream())
|
let conn = newConnection(newTestDecodeStream())
|
||||||
# let (id, msgType) = await conn.readHeader()
|
let (id, msgType) = await conn.readHeader()
|
||||||
|
|
||||||
# check id == 17
|
check id == 17
|
||||||
# check msgType == MessageType.New
|
check msgType == MessageType.New
|
||||||
# let data = await conn.readLp()
|
let data = await conn.readLp()
|
||||||
# check cast[string](data) == "17"
|
check cast[string](data) == "17"
|
||||||
# result = true
|
result = true
|
||||||
|
|
||||||
# check:
|
check:
|
||||||
# waitFor(testDecodeHeader()) == true
|
waitFor(testDecodeHeader()) == true
|
||||||
|
|
||||||
test "e2e - read/write initiator":
|
test "e2e - read/write initiator":
|
||||||
proc testNewStream(): Future[bool] {.async.} =
|
proc testNewStream(): Future[bool] {.async.} =
|
||||||
|
|
Loading…
Reference in New Issue