mirror of
https://github.com/logos-storage/nim-json-rpc.git
synced 2026-07-28 10:43:15 +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:
|
when isMainModule:
|
||||||
proc main {.async.} =
|
suite "RPC":
|
||||||
var client = newRpcClient()
|
proc main {.async.} =
|
||||||
await client.connect("localhost", Port(8545))
|
var client = newRpcClient()
|
||||||
var
|
await client.connect("localhost", Port(8545))
|
||||||
response: Response
|
var response: Response
|
||||||
|
|
||||||
for i in 0..1000:
|
test "Version":
|
||||||
response = waitFor client.web3_clientVersion(newJNull())
|
response = waitFor client.web3_clientVersion(newJNull())
|
||||||
waitFor main()
|
check response.result == %"Nimbus-RPC-Test"
|
||||||
|
test "SHA3":
|
||||||
|
response = waitFor client.web3_sha3(%"abc")
|
||||||
|
check response.result.getStr == "3A985DA74FE225B2045C172D6BD390BD855F086E3E9D525B46BFE24511431532"
|
||||||
|
|
||||||
|
waitFor main()
|
||||||
echo "Finished."
|
echo "Finished."
|
||||||
Loading…
x
Reference in New Issue
Block a user