mirror of
https://github.com/status-im/nim-libp2p.git
synced 2025-01-10 04:56:08 +00:00
55b763264e
* add async testing methods * refactor with async testing methods * use iffy in async tests
32 lines
607 B
Nim
32 lines
607 B
Nim
import unittest
|
|
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
|