diff options
author | Fabio Berger <me@fabioberger.com> | 2017-08-31 01:47:14 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-08-31 01:47:14 +0800 |
commit | 4620c1c818e6d54741b262e2100d2731dae16dda (patch) | |
tree | 2bb1e842a02780ec009995e1481997895885ff7b /test | |
parent | 4370e19880966cf00726a6fae41cfaa5f751e881 (diff) | |
parent | 5f44b5f7111873a3958050503fff0ed098b65b04 (diff) | |
download | dexon-sol-tools-4620c1c818e6d54741b262e2100d2731dae16dda.tar dexon-sol-tools-4620c1c818e6d54741b262e2100d2731dae16dda.tar.gz dexon-sol-tools-4620c1c818e6d54741b262e2100d2731dae16dda.tar.bz2 dexon-sol-tools-4620c1c818e6d54741b262e2100d2731dae16dda.tar.lz dexon-sol-tools-4620c1c818e6d54741b262e2100d2731dae16dda.tar.xz dexon-sol-tools-4620c1c818e6d54741b262e2100d2731dae16dda.tar.zst dexon-sol-tools-4620c1c818e6d54741b262e2100d2731dae16dda.zip |
Merge branch 'development' of github.com:0xProject/0x.js into development
* 'development' of github.com:0xProject/0x.js:
Improve the comment
Add assert.isWeb3Provider
Use more concise dep pointing
Don't create whole web3 object in beta tests
Improve the comment
Add tests for web3@1.0
Use zeroEx.getAvailableAddressesAsync instead of web3.eth.getAccounts
Add web3@1.0 to web3Factory
Support web3@1.0 providers
Define web3@1.0 types ;)
Install web3@1.0.0 as web3_beta
Diffstat (limited to 'test')
-rw-r--r-- | test/ether_token_wrapper_test.ts | 2 | ||||
-rw-r--r-- | test/exchange_wrapper_test.ts | 2 | ||||
-rw-r--r-- | test/order_validation_test.ts | 2 | ||||
-rw-r--r-- | test/token_wrapper_test.ts | 2 | ||||
-rw-r--r-- | test/utils/web3_factory.ts | 6 | ||||
-rw-r--r-- | test/web3_beta_test.ts | 16 |
6 files changed, 26 insertions, 4 deletions
diff --git a/test/ether_token_wrapper_test.ts b/test/ether_token_wrapper_test.ts index b40061a41..601800cd1 100644 --- a/test/ether_token_wrapper_test.ts +++ b/test/ether_token_wrapper_test.ts @@ -33,7 +33,7 @@ describe('EtherTokenWrapper', () => { before(async () => { web3 = web3Factory.create(); zeroEx = new ZeroEx(web3.currentProvider, zeroExConfig); - userAddresses = await promisify(web3.eth.getAccounts)(); + userAddresses = await zeroEx.getAvailableAddressesAsync(); addressWithETH = userAddresses[0]; wethContractAddress = await zeroEx.etherToken.getContractAddressAsync(); depositWeiAmount = (zeroEx as any)._web3Wrapper.toWei(new BigNumber(5)); diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts index 080be774a..90ac37387 100644 --- a/test/exchange_wrapper_test.ts +++ b/test/exchange_wrapper_test.ts @@ -44,7 +44,7 @@ describe('ExchangeWrapper', () => { web3 = web3Factory.create(); zeroEx = new ZeroEx(web3.currentProvider); exchangeContractAddress = await zeroEx.exchange.getContractAddressAsync(); - userAddresses = await promisify(web3.eth.getAccounts)(); + userAddresses = await zeroEx.getAvailableAddressesAsync(); tokens = await zeroEx.tokenRegistry.getTokensAsync(); tokenUtils = new TokenUtils(tokens); zrxTokenAddress = tokenUtils.getProtocolTokenOrThrow().address; diff --git a/test/order_validation_test.ts b/test/order_validation_test.ts index 8a6303f3a..93bcfcce0 100644 --- a/test/order_validation_test.ts +++ b/test/order_validation_test.ts @@ -37,7 +37,7 @@ describe('OrderValidation', () => { web3 = web3Factory.create(); zeroEx = new ZeroEx(web3.currentProvider); exchangeContractAddress = await zeroEx.exchange.getContractAddressAsync(); - userAddresses = await promisify(web3.eth.getAccounts)(); + userAddresses = await zeroEx.getAvailableAddressesAsync(); [coinbase, makerAddress, takerAddress, feeRecipient] = userAddresses; tokens = await zeroEx.tokenRegistry.getTokensAsync(); tokenUtils = new TokenUtils(tokens); diff --git a/test/token_wrapper_test.ts b/test/token_wrapper_test.ts index f4653e432..88833e612 100644 --- a/test/token_wrapper_test.ts +++ b/test/token_wrapper_test.ts @@ -34,7 +34,7 @@ describe('TokenWrapper', () => { before(async () => { web3 = web3Factory.create(); zeroEx = new ZeroEx(web3.currentProvider); - userAddresses = await promisify(web3.eth.getAccounts)(); + userAddresses = await zeroEx.getAvailableAddressesAsync(); tokens = await zeroEx.tokenRegistry.getTokensAsync(); tokenUtils = new TokenUtils(tokens); coinbase = userAddresses[0]; diff --git a/test/utils/web3_factory.ts b/test/utils/web3_factory.ts index b20070c74..4785fa858 100644 --- a/test/utils/web3_factory.ts +++ b/test/utils/web3_factory.ts @@ -6,6 +6,7 @@ import ProviderEngine = require('web3-provider-engine'); import RpcSubprovider = require('web3-provider-engine/subproviders/rpc'); import * as Web3 from 'web3'; +import * as Web3_beta from 'web3_beta'; import {constants} from './constants'; import {EmptyWalletSubProvider} from '../../src/subproviders/empty_wallet_subprovider'; @@ -28,4 +29,9 @@ export const web3Factory = { provider.start(); return provider; }, + getProviderBeta(): Web3.Provider { + const rpcUrl = `http://${constants.RPC_HOST}:${constants.RPC_PORT}`; + const providerBeta = new Web3_beta.providers.HttpProvider(rpcUrl); + return providerBeta; + }, }; diff --git a/test/web3_beta_test.ts b/test/web3_beta_test.ts new file mode 100644 index 000000000..e34812243 --- /dev/null +++ b/test/web3_beta_test.ts @@ -0,0 +1,16 @@ +import * as chai from 'chai'; +import {chaiSetup} from './utils/chai_setup'; +import 'mocha'; +import {ZeroEx, Order, SubscriptionOpts, TokenEvents, ContractEvent} from '../src'; +import {web3Factory} from './utils/web3_factory'; + +chaiSetup.configure(); +const expect = chai.expect; + +describe('ZeroEx with beta web3', () => { + const web3_beta_provider = web3Factory.getProviderBeta(); + const zeroEx = new ZeroEx(web3_beta_provider); + it('is able to make a call using a beta provider', async () => { + await zeroEx.tokenRegistry.getTokenAddressesAsync(); + }); +}); |