diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-02-13 01:15:14 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-02-15 03:51:26 +0800 |
commit | 8cd2ba3ad637915ab335d87d530f754d104bbdd4 (patch) | |
tree | 7b10a27d3943dae81bed7e3e95bf6c77de99846c /packages/dev-utils/test/blockchain_lifecycle_test.ts | |
parent | dbad7d18691e787bfc1c8e63a0e712f652486865 (diff) | |
download | dexon-0x-contracts-8cd2ba3ad637915ab335d87d530f754d104bbdd4.tar.gz dexon-0x-contracts-8cd2ba3ad637915ab335d87d530f754d104bbdd4.tar.zst dexon-0x-contracts-8cd2ba3ad637915ab335d87d530f754d104bbdd4.zip |
Add tests for dev-utils package
Diffstat (limited to 'packages/dev-utils/test/blockchain_lifecycle_test.ts')
-rw-r--r-- | packages/dev-utils/test/blockchain_lifecycle_test.ts | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/packages/dev-utils/test/blockchain_lifecycle_test.ts b/packages/dev-utils/test/blockchain_lifecycle_test.ts new file mode 100644 index 000000000..14712faa0 --- /dev/null +++ b/packages/dev-utils/test/blockchain_lifecycle_test.ts @@ -0,0 +1,25 @@ +import { BlockParamLiteral } from '@0xproject/types'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import * as chai from 'chai'; +import 'mocha'; + +import { BlockchainLifecycle, RPC, web3Factory } from '../src'; + +const expect = chai.expect; + +describe('BlockchainLifecycle tests', () => { + const web3 = web3Factory.create(); + const web3Wrapper = new Web3Wrapper(web3.currentProvider); + const rpc = new RPC(); + const blockchainLifecycle = new BlockchainLifecycle(); + describe('#startAsync/revertAsync', () => { + it('reverts changes in between', async () => { + const blockNumberBefore = await web3Wrapper.getBlockNumberAsync(); + await blockchainLifecycle.startAsync(); + await rpc.mineBlockAsync(); + await blockchainLifecycle.revertAsync(); + const blockNumberAfter = await web3Wrapper.getBlockNumberAsync(); + expect(blockNumberAfter).to.be.equal(blockNumberBefore); + }); + }); +}); |