Add simple daemon spawn test.

This commit is contained in:
cheatfate 2018-11-19 06:34:05 +02:00
parent 9262aa5e9e
commit dc482dfb45
2 changed files with 16 additions and 1 deletions

View File

@ -10,4 +10,5 @@ skipDirs = @["tests", "Nim"]
requires "nim > 0.18.0" requires "nim > 0.18.0"
task tests, "Runs the test suite": task tests, "Runs the test suite":
exec "nim c -r tests/testpbvarint" exec "nim c -r tests/testpbvarint"
exec "nim c -r tests/testdaemon"

14
tests/testdaemon.nim Normal file
View File

@ -0,0 +1,14 @@
import unittest
import asyncdispatch2
import ../libp2p/daemon/daemonapi
proc identitySpawnTest(): Future[bool] {.async.} =
var api = await newDaemonApi(sockpath = "/tmp/p2pd-1.sock")
var data = await api.identity()
await api.close()
result = true
when isMainModule:
suite "libp2p-daemon test suite":
test "Simple spawn and get identity test":
waitFor identitySpawnTest() == true