Update tests to run with `nimble test`

This commit is contained in:
coffeepots 2018-04-24 13:50:56 +01:00
parent d8fa488e24
commit 189c8c70a8
1 changed files with 17 additions and 18 deletions

View File

@ -12,23 +12,22 @@ srv.on("myProc") do(input: string):
asyncCheck srv.serve
when isMainModule:
suite "RPC":
proc main {.async.} =
var client = newRpcClient()
await client.connect("localhost", Port(8545))
var response: Response
suite "RPC":
proc main {.async.} =
var client = newRpcClient()
await client.connect("localhost", Port(8545))
var response: Response
test "Version":
response = waitFor client.web3_clientVersion(newJNull())
check response.result == %"Nimbus-RPC-Test"
test "SHA3":
response = waitFor client.web3_sha3(%["abc"])
check response.result.getStr == "3A985DA74FE225B2045C172D6BD390BD855F086E3E9D525B46BFE24511431532"
test "Custom RPC":
response = waitFor client.call("myProc", %["abc"])
check response.result.getStr == "Hello abc"
test "Version":
response = waitFor client.web3_clientVersion(newJNull())
check response.result == %"Nimbus-RPC-Test"
test "SHA3":
response = waitFor client.web3_sha3(%["abc"])
check response.result.getStr == "3A985DA74FE225B2045C172D6BD390BD855F086E3E9D525B46BFE24511431532"
test "Custom RPC":
response = waitFor client.call("myProc", %["abc"])
check response.result.getStr == "Hello abc"
waitFor main()
waitFor main()