nim-libp2p/tests/testconnection.nim
Dmitriy Ryajov ac4e060e1a
adding raises defect across the codebase (#572)
* 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
2021-05-21 10:27:01 -06:00

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