mirror of
https://github.com/logos-storage/nim-json-rpc.git
synced 2026-01-06 23:53:09 +00:00
Adding some proper tests
This commit is contained in:
parent
ff4e5b8f7d
commit
e5c52dab3c
@ -1,13 +1,18 @@
|
||||
import ../src/rpcclient, asyncdispatch, json
|
||||
import ../eth-rpc/rpcclient, asyncdispatch, json, unittest
|
||||
|
||||
when isMainModule:
|
||||
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
|
||||
|
||||
for i in 0..1000:
|
||||
response = waitFor client.web3_clientVersion(newJNull())
|
||||
waitFor main()
|
||||
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"
|
||||
|
||||
waitFor main()
|
||||
echo "Finished."
|
||||
Loading…
x
Reference in New Issue
Block a user