nim-libp2p-experimental/tests/testconnection.nim

31 lines
594 B
Nim
Raw Normal View History

2020-04-05 02:45:00 +00:00
import chronos, nimcrypto/utils
import ../libp2p/[stream/connection,
2020-04-05 02:45:00 +00:00
stream/bufferstream]
import ./helpers
2020-04-05 02:45:00 +00:00
suite "Connection":
asyncTest "close":
var conn = BufferStream.new()
await conn.close()
2020-04-05 02:45:00 +00:00
check:
conn.closed == true
2020-04-05 02:45:00 +00:00
asyncTest "parent close":
var buf = BufferStream.new()
var conn = buf
2020-04-05 02:45:00 +00:00
await conn.close()
2020-04-05 02:45:00 +00:00
check:
conn.closed == true
buf.closed == true
2020-04-05 02:45:00 +00:00
asyncTest "child close":
var buf = BufferStream.new()
var conn = buf
2020-04-05 02:45:00 +00:00
await buf.close()
2020-04-05 02:45:00 +00:00
check:
conn.closed == true
buf.closed == true