diff options
author | Fabio Berger <me@fabioberger.com> | 2017-11-13 09:50:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-13 09:50:42 +0800 |
commit | b0be323e899ea7be42b6c695b4fd6d526070b213 (patch) | |
tree | 86042b06c407b388e39be690d9a40db218f82675 /test/utils | |
parent | 1392a855bb17981f7680548a23062842fb6dc4e0 (diff) | |
parent | a22661670f105a2bf527aca0e803689e0302ed17 (diff) | |
download | dexon-sol-tools-b0be323e899ea7be42b6c695b4fd6d526070b213.tar dexon-sol-tools-b0be323e899ea7be42b6c695b4fd6d526070b213.tar.gz dexon-sol-tools-b0be323e899ea7be42b6c695b4fd6d526070b213.tar.bz2 dexon-sol-tools-b0be323e899ea7be42b6c695b4fd6d526070b213.tar.lz dexon-sol-tools-b0be323e899ea7be42b6c695b4fd6d526070b213.tar.xz dexon-sol-tools-b0be323e899ea7be42b6c695b4fd6d526070b213.tar.zst dexon-sol-tools-b0be323e899ea7be42b6c695b4fd6d526070b213.zip |
Merge pull request #205 from 0xProject/orderWatcher
Order watcher
Diffstat (limited to 'test/utils')
-rw-r--r-- | test/utils/blockchain_lifecycle.ts | 3 | ||||
-rw-r--r-- | test/utils/report_callback_errors.ts | 14 | ||||
-rw-r--r-- | test/utils/rpc.ts | 6 |
3 files changed, 23 insertions, 0 deletions
diff --git a/test/utils/blockchain_lifecycle.ts b/test/utils/blockchain_lifecycle.ts index 9fdf0e856..9a44ccd6f 100644 --- a/test/utils/blockchain_lifecycle.ts +++ b/test/utils/blockchain_lifecycle.ts @@ -20,4 +20,7 @@ export class BlockchainLifecycle { throw new Error(`Snapshot with id #${snapshotId} failed to revert`); } } + public async mineABlock(): Promise<void> { + await this.rpc.mineBlockAsync(); + } } diff --git a/test/utils/report_callback_errors.ts b/test/utils/report_callback_errors.ts new file mode 100644 index 000000000..d471b2af2 --- /dev/null +++ b/test/utils/report_callback_errors.ts @@ -0,0 +1,14 @@ +import { DoneCallback } from '../../src/types'; + +export const reportCallbackErrors = (done: DoneCallback) => { + return (f: (...args: any[]) => void) => { + const wrapped = (...args: any[]) => { + try { + f(...args); + } catch (err) { + done(err); + } + }; + return wrapped; + }; +}; diff --git a/test/utils/rpc.ts b/test/utils/rpc.ts index f28a85340..299e72e79 100644 --- a/test/utils/rpc.ts +++ b/test/utils/rpc.ts @@ -26,6 +26,12 @@ export class RPC { const didRevert = await this.sendAsync(payload); return didRevert; } + public async mineBlockAsync(): Promise<void> { + const method = 'evm_mine'; + const params: any[] = []; + const payload = this.toPayload(method, params); + await this.sendAsync(payload); + } private toPayload(method: string, params: any[] = []): string { const payload = JSON.stringify({ id: this.id, |