mirror of
https://github.com/status-im/nim-dagger.git
synced 2025-01-10 14:46:03 +00:00
bd594c9aaf
* adding tracker for streamstore * adding tracker tests * Sets up tracker helper functions and closes streams in testnode.nim * Deploying checksuite for memory leak tracker checking. * Successfully deploys checksuite and asyncchecksuite. * Fix leak in testpor.nim * Fixes leaked storestream in testnetwork.nim * Fixes integration tests * Cleanup * cleanup comment by Mark --------- Co-authored-by: benbierens <thatbenbierens@gmail.com>
31 lines
816 B
Nim
31 lines
816 B
Nim
import std/json
|
|
import pkg/asynctest
|
|
import pkg/ethers
|
|
|
|
import ./helpers
|
|
import ./checktest
|
|
|
|
## Unit testing suite that sets up an Ethereum testing environment.
|
|
## Injects a `provider` instance, and a list of `accounts`.
|
|
## Calls the `evm_snapshot` and `evm_revert` methods to ensure that any
|
|
## changes to the blockchain do not persist.
|
|
template ethersuite*(name, body) =
|
|
asyncchecksuite name:
|
|
|
|
var provider {.inject, used.}: JsonRpcProvider
|
|
var accounts {.inject, used.}: seq[Address]
|
|
var snapshot: JsonNode
|
|
|
|
setup:
|
|
provider = JsonRpcProvider.new("ws://localhost:8545")
|
|
snapshot = await send(provider, "evm_snapshot")
|
|
accounts = await provider.listAccounts()
|
|
|
|
teardown:
|
|
discard await send(provider, "evm_revert", @[snapshot])
|
|
|
|
body
|
|
|
|
export asynctest
|
|
export ethers
|