From d5feb5fc792c54bcf4a3a029ddc404e95a5df166 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 26 May 2017 18:01:54 +0200 Subject: rename BlockClean to BlockchainLifecycle and setupAsync to startAsync, restoreAsync to revertAsync --- test/utils/blockchain_clean.ts | 19 ------------------- test/utils/blockchain_lifecycle.ts | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 19 deletions(-) delete mode 100644 test/utils/blockchain_clean.ts create mode 100644 test/utils/blockchain_lifecycle.ts (limited to 'test/utils') diff --git a/test/utils/blockchain_clean.ts b/test/utils/blockchain_clean.ts deleted file mode 100644 index 18b7e3a5b..000000000 --- a/test/utils/blockchain_clean.ts +++ /dev/null @@ -1,19 +0,0 @@ -import {RPC} from './rpc'; - -export class BlockchainClean { - private rpc: RPC; - private snapshotId: number; - constructor() { - this.rpc = new RPC(); - } - // TODO: Check if running on TestRPC or on actual node, if actual node, re-deploy contracts instead - public async setupAsync(): Promise { - this.snapshotId = await this.rpc.takeSnapshotAsync(); - } - public async restoreAsync(): Promise { - const didRevert = await this.rpc.revertSnapshotAsync(this.snapshotId); - if (!didRevert) { - throw new Error(`Snapshot with id #${this.snapshotId} failed to revert`); - } - } -}; diff --git a/test/utils/blockchain_lifecycle.ts b/test/utils/blockchain_lifecycle.ts new file mode 100644 index 000000000..f7342b680 --- /dev/null +++ b/test/utils/blockchain_lifecycle.ts @@ -0,0 +1,19 @@ +import {RPC} from './rpc'; + +export class BlockchainLifecycle { + private rpc: RPC; + private snapshotId: number; + constructor() { + this.rpc = new RPC(); + } + // TODO: Check if running on TestRPC or on actual node, if actual node, re-deploy contracts instead + public async startAsync(): Promise { + this.snapshotId = await this.rpc.takeSnapshotAsync(); + } + public async revertAsync(): Promise { + const didRevert = await this.rpc.revertSnapshotAsync(this.snapshotId); + if (!didRevert) { + throw new Error(`Snapshot with id #${this.snapshotId} failed to revert`); + } + } +}; -- cgit v1.2.3