From dc482dfb455885171d3d70fe74074c474ae23a04 Mon Sep 17 00:00:00 2001 From: cheatfate Date: Mon, 19 Nov 2018 06:34:05 +0200 Subject: [PATCH] Add simple daemon spawn test. --- libp2p.nimble | 3 ++- tests/testdaemon.nim | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/testdaemon.nim diff --git a/libp2p.nimble b/libp2p.nimble index def5c4555..f52d2c841 100644 --- a/libp2p.nimble +++ b/libp2p.nimble @@ -10,4 +10,5 @@ skipDirs = @["tests", "Nim"] requires "nim > 0.18.0" task tests, "Runs the test suite": - exec "nim c -r tests/testpbvarint" \ No newline at end of file + exec "nim c -r tests/testpbvarint" + exec "nim c -r tests/testdaemon" \ No newline at end of file diff --git a/tests/testdaemon.nim b/tests/testdaemon.nim new file mode 100644 index 000000000..35e603519 --- /dev/null +++ b/tests/testdaemon.nim @@ -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