diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-05-22 04:56:32 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-06-07 03:39:39 +0800 |
commit | 577156fe5f63e581b101682d13b7e70e7a9336e5 (patch) | |
tree | 202d928d4888825a4ea1f24e2fd03368643c2966 /packages/web3-wrapper/test | |
parent | da3f783a9ff69b059b1a98f502d980660d6bacab (diff) | |
download | dexon-sol-tools-577156fe5f63e581b101682d13b7e70e7a9336e5.tar dexon-sol-tools-577156fe5f63e581b101682d13b7e70e7a9336e5.tar.gz dexon-sol-tools-577156fe5f63e581b101682d13b7e70e7a9336e5.tar.bz2 dexon-sol-tools-577156fe5f63e581b101682d13b7e70e7a9336e5.tar.lz dexon-sol-tools-577156fe5f63e581b101682d13b7e70e7a9336e5.tar.xz dexon-sol-tools-577156fe5f63e581b101682d13b7e70e7a9336e5.tar.zst dexon-sol-tools-577156fe5f63e581b101682d13b7e70e7a9336e5.zip |
Use Geth for contract tests
Diffstat (limited to 'packages/web3-wrapper/test')
-rw-r--r-- | packages/web3-wrapper/test/web3_wrapper_test.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/packages/web3-wrapper/test/web3_wrapper_test.ts b/packages/web3-wrapper/test/web3_wrapper_test.ts index 326efe654..1843bcf2c 100644 --- a/packages/web3-wrapper/test/web3_wrapper_test.ts +++ b/packages/web3-wrapper/test/web3_wrapper_test.ts @@ -2,6 +2,7 @@ import * as chai from 'chai'; import * as Ganache from 'ganache-core'; import 'make-promises-safe'; import 'mocha'; +import * as Web3 from 'web3'; import { Web3Wrapper } from '../src'; @@ -37,4 +38,22 @@ describe('Web3Wrapper tests', () => { expect(networkId).to.be.equal(NETWORK_ID); }); }); + describe('mining functions', () => { + it('starts and stops the miner', async () => { + // Note: depending on our provider, the miner may or may not already + // be mining. To account for both conditions, we have what might + // look like too many stops and starts here, but it is necessary. + await web3Wrapper.minerStopAsync(); + let isMining = await web3Wrapper.isMiningAsync(); + expect(isMining).to.be.false(); + await web3Wrapper.minerStartAsync(1); + isMining = await web3Wrapper.isMiningAsync(); + expect(isMining).to.be.true(); + isMining = await web3Wrapper.isMiningAsync(); + expect(isMining).to.be.true(); + await web3Wrapper.minerStopAsync(); + isMining = await web3Wrapper.isMiningAsync(); + expect(isMining).to.be.false(); + }); + }); }); |