mirror of
https://github.com/vacp2p/nim-libp2p.git
synced 2025-01-10 16:55:57 +00:00
ac4e060e1a
* adding raises defect across the codebase * use unittest2 * add windows deps caching * update mingw link * die on failed peerinfo initialization * use result.expect instead of get * use expect more consistently and rework inits * use expect more consistently * throw on missing public key * remove unused closure annotation * merge master
31 lines
591 B
Nim
31 lines
591 B
Nim
import chronos, nimcrypto/utils
|
|
import ../libp2p/[stream/connection,
|
|
stream/bufferstream]
|
|
|
|
import ./helpers
|
|
|
|
suite "Connection":
|
|
asyncTest "close":
|
|
var conn = newBufferStream()
|
|
await conn.close()
|
|
check:
|
|
conn.closed == true
|
|
|
|
asyncTest "parent close":
|
|
var buf = newBufferStream()
|
|
var conn = buf
|
|
|
|
await conn.close()
|
|
check:
|
|
conn.closed == true
|
|
buf.closed == true
|
|
|
|
asyncTest "child close":
|
|
var buf = newBufferStream()
|
|
var conn = buf
|
|
|
|
await buf.close()
|
|
check:
|
|
conn.closed == true
|
|
buf.closed == true
|