aboutsummaryrefslogtreecommitdiffstats
path: root/packages/dev-utils/test
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-03-14 21:16:08 +0800
committerFabio Berger <me@fabioberger.com>2018-03-14 21:16:08 +0800
commit009b70f5b218a1ccb154034936256308131b7d9c (patch)
treecd9642a8d3323c9e80da54ac4e8fc40ade9f9020 /packages/dev-utils/test
parentf7c1e10b5ac112866ee55e7fededdb37c890d30f (diff)
parent3f3e8be004818ddaa1921b3dff12bdd46052278b (diff)
downloaddexon-sol-tools-009b70f5b218a1ccb154034936256308131b7d9c.tar
dexon-sol-tools-009b70f5b218a1ccb154034936256308131b7d9c.tar.gz
dexon-sol-tools-009b70f5b218a1ccb154034936256308131b7d9c.tar.bz2
dexon-sol-tools-009b70f5b218a1ccb154034936256308131b7d9c.tar.lz
dexon-sol-tools-009b70f5b218a1ccb154034936256308131b7d9c.tar.xz
dexon-sol-tools-009b70f5b218a1ccb154034936256308131b7d9c.tar.zst
dexon-sol-tools-009b70f5b218a1ccb154034936256308131b7d9c.zip
Merge branch 'development' into convertScriptsToTs
* development: (71 commits) Transform input data before encoding for callAsync and getABIEncodedTransactionData Update coverage badge to show development coverage Configure post build hook Notify coveralls after all tasks have finished Address feedback Revert "Report all coverage reports together" Separate published packages and typescript typings on README Report all coverage reports together Add other statement types Properly and consistently parse ENV vars Add forgotten file Start using solidity-parser-antlr Fix the default always overriding to address Submit a TD PR Add an explanatory comment for making ranges unique Fix a typo in handling env variables Introduce TESTRPC_FIRST_ADDRESS Make BlockchainLifecycle accept only web3Wrapper Fix comments Fix deployer CHANGELOG ... # Conflicts: # README.md # packages/deployer/package.json # packages/subproviders/src/globals.d.ts # yarn.lock
Diffstat (limited to 'packages/dev-utils/test')
-rw-r--r--packages/dev-utils/test/blockchain_lifecycle_test.ts11
-rw-r--r--packages/dev-utils/test/rpc_test.ts19
2 files changed, 14 insertions, 16 deletions
diff --git a/packages/dev-utils/test/blockchain_lifecycle_test.ts b/packages/dev-utils/test/blockchain_lifecycle_test.ts
index 4fdc53c87..5ed67e012 100644
--- a/packages/dev-utils/test/blockchain_lifecycle_test.ts
+++ b/packages/dev-utils/test/blockchain_lifecycle_test.ts
@@ -3,20 +3,19 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as chai from 'chai';
import 'mocha';
-import { BlockchainLifecycle, RPC, web3Factory } from '../src';
+import { BlockchainLifecycle, 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();
+ const web3Provider = web3Factory.getRpcProvider();
+ const web3Wrapper = new Web3Wrapper(web3Provider);
+ const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
describe('#startAsync/revertAsync', () => {
it('reverts changes in between', async () => {
const blockNumberBefore = await web3Wrapper.getBlockNumberAsync();
await blockchainLifecycle.startAsync();
- await rpc.mineBlockAsync();
+ await web3Wrapper.mineBlockAsync();
const blockNumberAfter = await web3Wrapper.getBlockNumberAsync();
expect(blockNumberAfter).to.be.equal(blockNumberBefore + 1);
await blockchainLifecycle.revertAsync();
diff --git a/packages/dev-utils/test/rpc_test.ts b/packages/dev-utils/test/rpc_test.ts
index 2f0e5ff7f..1bdea3613 100644
--- a/packages/dev-utils/test/rpc_test.ts
+++ b/packages/dev-utils/test/rpc_test.ts
@@ -3,18 +3,17 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as chai from 'chai';
import 'mocha';
-import { RPC, web3Factory } from '../src';
+import { web3Factory } from '../src';
const expect = chai.expect;
describe('RPC tests', () => {
- const web3 = web3Factory.create();
- const web3Wrapper = new Web3Wrapper(web3.currentProvider);
- const rpc = new RPC();
+ const web3Provider = web3Factory.getRpcProvider();
+ const web3Wrapper = new Web3Wrapper(web3Provider);
describe('#mineBlockAsync', () => {
it('increases block number when called', async () => {
const blockNumberBefore = await web3Wrapper.getBlockNumberAsync();
- await rpc.mineBlockAsync();
+ await web3Wrapper.mineBlockAsync();
const blockNumberAfter = await web3Wrapper.getBlockNumberAsync();
expect(blockNumberAfter).to.be.equal(blockNumberBefore + 1);
});
@@ -23,8 +22,8 @@ describe('RPC tests', () => {
it('increases time when called', async () => {
const TIME_DELTA = 1000;
const blockTimestampBefore = await web3Wrapper.getBlockTimestampAsync(BlockParamLiteral.Latest);
- await rpc.increaseTimeAsync(TIME_DELTA);
- await rpc.mineBlockAsync();
+ await web3Wrapper.increaseTimeAsync(TIME_DELTA);
+ await web3Wrapper.mineBlockAsync();
const blockTimestampAfter = await web3Wrapper.getBlockTimestampAsync(BlockParamLiteral.Latest);
expect(blockTimestampAfter).to.be.at.least(blockTimestampBefore + TIME_DELTA);
});
@@ -32,9 +31,9 @@ describe('RPC tests', () => {
describe('#takeSnapshotAsync/revertSnapshotAsync', () => {
it('reverts changes in between', async () => {
const blockNumberBefore = await web3Wrapper.getBlockNumberAsync();
- const snapshotId = await rpc.takeSnapshotAsync();
- await rpc.mineBlockAsync();
- await rpc.revertSnapshotAsync(snapshotId);
+ const snapshotId = await web3Wrapper.takeSnapshotAsync();
+ await web3Wrapper.mineBlockAsync();
+ await web3Wrapper.revertSnapshotAsync(snapshotId);
const blockNumberAfter = await web3Wrapper.getBlockNumberAsync();
expect(blockNumberAfter).to.be.equal(blockNumberBefore);
});