nim-libp2p/tests/testconnection.nim
Tanguy Cizain caac8191d2
Change newXXXX procs to XXXX.new (#585)
* newBufferStream -> BufferStream.new

* newMultistream -> MultistreamSelect.new

* newSecio -> Secio.new

* newNoise -> Noise.new

* newPlainText -> PlainText.new

* newPubSubPeer -> PubSubPeer.new

* newIdentify -> Identify.new

* newMuxerProvider -> MuxerProvider.new
2021-06-07 09:32:08 +02:00

31 lines
594 B
Nim

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