diff options
author | Leonid <logvinov.leon@gmail.com> | 2017-10-06 20:24:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-06 20:24:42 +0800 |
commit | f38d2f80a6e3af4ff7e2454d42abdf2a389e4303 (patch) | |
tree | 9e2f94e7d8236f7612628288d7eab3333d240b6b /test/utils/blockchain_lifecycle.ts | |
parent | cd5327bc31618b4ea268de1902a74cf862987ee6 (diff) | |
parent | 0c112a2a1c1811e1fc7c4b03881f960b952c788c (diff) | |
download | dexon-sol-tools-f38d2f80a6e3af4ff7e2454d42abdf2a389e4303.tar dexon-sol-tools-f38d2f80a6e3af4ff7e2454d42abdf2a389e4303.tar.gz dexon-sol-tools-f38d2f80a6e3af4ff7e2454d42abdf2a389e4303.tar.bz2 dexon-sol-tools-f38d2f80a6e3af4ff7e2454d42abdf2a389e4303.tar.lz dexon-sol-tools-f38d2f80a6e3af4ff7e2454d42abdf2a389e4303.tar.xz dexon-sol-tools-f38d2f80a6e3af4ff7e2454d42abdf2a389e4303.tar.zst dexon-sol-tools-f38d2f80a6e3af4ff7e2454d42abdf2a389e4303.zip |
Merge pull request #182 from 0xProject/feature/ethereumjs-blockstream
Rewrite subscriptions
Diffstat (limited to 'test/utils/blockchain_lifecycle.ts')
-rw-r--r-- | test/utils/blockchain_lifecycle.ts | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/test/utils/blockchain_lifecycle.ts b/test/utils/blockchain_lifecycle.ts index 50eb57b95..9fdf0e856 100644 --- a/test/utils/blockchain_lifecycle.ts +++ b/test/utils/blockchain_lifecycle.ts @@ -2,19 +2,22 @@ import {RPC} from './rpc'; export class BlockchainLifecycle { private rpc: RPC; - private snapshotId: number; + private snapshotIdsStack: number[]; constructor() { this.rpc = new RPC(); + this.snapshotIdsStack = []; } // 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(); + const snapshotId = await this.rpc.takeSnapshotAsync(); + this.snapshotIdsStack.push(snapshotId); } public async revertAsync(): Promise<void> { - const didRevert = await this.rpc.revertSnapshotAsync(this.snapshotId); + const snapshotId = this.snapshotIdsStack.pop() as number; + const didRevert = await this.rpc.revertSnapshotAsync(snapshotId); if (!didRevert) { - throw new Error(`Snapshot with id #${this.snapshotId} failed to revert`); + throw new Error(`Snapshot with id #${snapshotId} failed to revert`); } } } |