aboutsummaryrefslogtreecommitdiffstats
path: root/test/0x.js_test.ts
diff options
context:
space:
mode:
authorLeonid <logvinov.leon@gmail.com>2017-09-20 20:59:48 +0800
committerGitHub <noreply@github.com>2017-09-20 20:59:48 +0800
commitd424933d70a0a6a210b19960451ef2796844c8d8 (patch)
tree349592a214b320b9a60e2775093639fe9ad6c278 /test/0x.js_test.ts
parentfe9f692a4f472e5decbda96aad6afaf98c10d850 (diff)
parent91679caf936d3b3df369b2339c55468b222c9a16 (diff)
downloaddexon-sol-tools-d424933d70a0a6a210b19960451ef2796844c8d8.tar
dexon-sol-tools-d424933d70a0a6a210b19960451ef2796844c8d8.tar.gz
dexon-sol-tools-d424933d70a0a6a210b19960451ef2796844c8d8.tar.bz2
dexon-sol-tools-d424933d70a0a6a210b19960451ef2796844c8d8.tar.lz
dexon-sol-tools-d424933d70a0a6a210b19960451ef2796844c8d8.tar.xz
dexon-sol-tools-d424933d70a0a6a210b19960451ef2796844c8d8.tar.zst
dexon-sol-tools-d424933d70a0a6a210b19960451ef2796844c8d8.zip
Merge pull request #165 from 0xProject/feature/configurable-addresses
Allow users to pass contract addresses as a config
Diffstat (limited to 'test/0x.js_test.ts')
-rw-r--r--test/0x.js_test.ts29
1 files changed, 27 insertions, 2 deletions
diff --git a/test/0x.js_test.ts b/test/0x.js_test.ts
index 5461a7d3f..cc6b91e99 100644
--- a/test/0x.js_test.ts
+++ b/test/0x.js_test.ts
@@ -4,12 +4,11 @@ import {chaiSetup} from './utils/chai_setup';
import 'mocha';
import * as BigNumber from 'bignumber.js';
import * as Sinon from 'sinon';
-import {ZeroEx, Order} from '../src';
+import {ZeroEx, Order, ZeroExError, LogWithDecodedArgs} from '../src';
import {constants} from './utils/constants';
import {TokenUtils} from './utils/token_utils';
import {web3Factory} from './utils/web3_factory';
import {BlockchainLifecycle} from './utils/blockchain_lifecycle';
-import {LogWithDecodedArgs} from '../src';
const blockchainLifecycle = new BlockchainLifecycle();
chaiSetup.configure();
@@ -231,4 +230,30 @@ describe('ZeroEx library', () => {
expect(log.args._value).to.be.bignumber.equal(zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS);
});
});
+ describe('#config', () => {
+ it('allows to specify exchange contract address', async () => {
+ const config = {
+ exchangeContractAddress: ZeroEx.NULL_ADDRESS,
+ };
+ const zeroExWithWrongExchangeAddress = new ZeroEx(web3.currentProvider, config);
+ return expect(zeroExWithWrongExchangeAddress.exchange.getContractAddressAsync())
+ .to.be.rejectedWith(ZeroExError.ContractDoesNotExist);
+ });
+ it('allows to specify ether token contract address', async () => {
+ const config = {
+ etherTokenContractAddress: ZeroEx.NULL_ADDRESS,
+ };
+ const zeroExWithWrongEtherTokenAddress = new ZeroEx(web3.currentProvider, config);
+ return expect(zeroExWithWrongEtherTokenAddress.etherToken.getContractAddressAsync())
+ .to.be.rejectedWith(ZeroExError.ContractDoesNotExist);
+ });
+ it('allows to specify token registry token contract address', async () => {
+ const config = {
+ tokenRegistryContractAddress: ZeroEx.NULL_ADDRESS,
+ };
+ const zeroExWithWrongTokenRegistryAddress = new ZeroEx(web3.currentProvider, config);
+ return expect(zeroExWithWrongTokenRegistryAddress.tokenRegistry.getContractAddressAsync())
+ .to.be.rejectedWith(ZeroExError.ContractDoesNotExist);
+ });
+ });
});