mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-01-10 04:55:40 +00:00
3907ca4095
* Add get active slot /slots/{slotId} to REST api, use utils/json - Add endpoint /slots/{slotId} to get an active SalesAgent from the Sales module. Used in integration tests to test when a sale has reached a certain state. Those integration test changes will be included in a larger PR, coming later. - Add OpenAPI changes for new endpoint and associated components - Use utils/json instead of nim-json-serialization. Required exemption of imports from several packages that export nim-json-serialization by default. * Only except `toJson` from import/export of chronicles
30 lines
810 B
Nim
30 lines
810 B
Nim
import std/json
|
|
import pkg/asynctest
|
|
import pkg/ethers
|
|
|
|
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 except `%`
|