diff options
author | Fabio Berger <me@fabioberger.com> | 2017-05-27 00:54:56 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-27 00:54:56 +0800 |
commit | b897bdab79fe566ffc8c19c6ec9f1bb7260fa95e (patch) | |
tree | 65abedae4adfa1694db877a8e041e57c29a547f9 /test/utils/blockchain_lifecycle.ts | |
parent | f338c68f126cba0f1b49c2928f276158b64d8ee7 (diff) | |
parent | 5d4c2dcb2950747c7cb2d95df340c23c981d70d3 (diff) | |
download | dexon-0x-contracts-b897bdab79fe566ffc8c19c6ec9f1bb7260fa95e.tar.gz dexon-0x-contracts-b897bdab79fe566ffc8c19c6ec9f1bb7260fa95e.tar.zst dexon-0x-contracts-b897bdab79fe566ffc8c19c6ec9f1bb7260fa95e.zip |
Merge pull request #14 from 0xProject/implementFirstExchangeMethod
Implement first exchange method
Diffstat (limited to 'test/utils/blockchain_lifecycle.ts')
-rw-r--r-- | test/utils/blockchain_lifecycle.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/utils/blockchain_lifecycle.ts b/test/utils/blockchain_lifecycle.ts new file mode 100644 index 000000000..68e169ac0 --- /dev/null +++ b/test/utils/blockchain_lifecycle.ts @@ -0,0 +1,20 @@ +import {RPC} from './rpc'; + +export class BlockchainLifecycle { + private rpc: RPC; + private snapshotId: number; + constructor() { + this.rpc = new RPC(); + } + // TODO: In order to run these tests on an actual node, we should check if we are running against + // TestRPC, if so, use snapshots, otherwise re-deploy contracts before every test + public async startAsync(): Promise<void> { + this.snapshotId = await this.rpc.takeSnapshotAsync(); + } + public async revertAsync(): Promise<void> { + const didRevert = await this.rpc.revertSnapshotAsync(this.snapshotId); + if (!didRevert) { + throw new Error(`Snapshot with id #${this.snapshotId} failed to revert`); + } + } +}; |