aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-02-09 17:33:33 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-02-15 03:22:36 +0800
commit49375c73d474fc844f3ee5b8f49244a33be52638 (patch)
tree34734c9c03e73a920494c335e71e88eb941fd3d4 /packages
parent98b78c56c5fb5fbcbda11da993fb8d88f3b71df8 (diff)
downloaddexon-sol-tools-49375c73d474fc844f3ee5b8f49244a33be52638.tar
dexon-sol-tools-49375c73d474fc844f3ee5b8f49244a33be52638.tar.gz
dexon-sol-tools-49375c73d474fc844f3ee5b8f49244a33be52638.tar.bz2
dexon-sol-tools-49375c73d474fc844f3ee5b8f49244a33be52638.tar.lz
dexon-sol-tools-49375c73d474fc844f3ee5b8f49244a33be52638.tar.xz
dexon-sol-tools-49375c73d474fc844f3ee5b8f49244a33be52638.tar.zst
dexon-sol-tools-49375c73d474fc844f3ee5b8f49244a33be52638.zip
Fix tests
Diffstat (limited to 'packages')
-rw-r--r--packages/0x.js/src/utils/assert.ts2
-rw-r--r--packages/0x.js/test/ether_token_wrapper_test.ts11
-rw-r--r--packages/0x.js/test/expiration_watcher_test.ts2
-rw-r--r--packages/0x.js/test/token_wrapper_test.ts1
-rw-r--r--packages/0x.js/test/utils/constants.ts6
5 files changed, 13 insertions, 9 deletions
diff --git a/packages/0x.js/src/utils/assert.ts b/packages/0x.js/src/utils/assert.ts
index c21f2dbca..f81e02f78 100644
--- a/packages/0x.js/src/utils/assert.ts
+++ b/packages/0x.js/src/utils/assert.ts
@@ -1,7 +1,7 @@
import { assert as sharedAssert } from '@0xproject/assert';
// We need those two unused imports because they're actually used by sharedAssert which gets injected here
// tslint:disable-next-line:no-unused-variable
-import { Schema } from '@0xproject/json-schemas';
+import { Schema, SchemaValidator } from '@0xproject/json-schemas';
// tslint:disable-next-line:no-unused-variable
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
diff --git a/packages/0x.js/test/ether_token_wrapper_test.ts b/packages/0x.js/test/ether_token_wrapper_test.ts
index da49ec467..72086dff0 100644
--- a/packages/0x.js/test/ether_token_wrapper_test.ts
+++ b/packages/0x.js/test/ether_token_wrapper_test.ts
@@ -75,11 +75,14 @@ describe('EtherTokenWrapper', () => {
const contractAddressIfExists = zeroEx.etherToken.getContractAddressIfExists();
expect(contractAddressIfExists).to.not.be.undefined();
});
- it('should return undefined if connected to an unknown network', () => {
+ it('should throw if connected to a private network and contract addresses are not specified', () => {
const UNKNOWN_NETWORK_NETWORK_ID = 10;
- const unknownNetworkZeroEx = new ZeroEx(web3.currentProvider, { networkId: UNKNOWN_NETWORK_NETWORK_ID });
- const contractAddressIfExists = unknownNetworkZeroEx.etherToken.getContractAddressIfExists();
- expect(contractAddressIfExists).to.be.undefined();
+ expect(
+ () =>
+ new ZeroEx(web3.currentProvider, {
+ networkId: UNKNOWN_NETWORK_NETWORK_ID,
+ } as any),
+ ).to.throw();
});
});
describe('#depositAsync', () => {
diff --git a/packages/0x.js/test/expiration_watcher_test.ts b/packages/0x.js/test/expiration_watcher_test.ts
index b49dee8e5..7f79e3802 100644
--- a/packages/0x.js/test/expiration_watcher_test.ts
+++ b/packages/0x.js/test/expiration_watcher_test.ts
@@ -9,10 +9,10 @@ import * as Web3 from 'web3';
import { ZeroEx } from '../src/0x';
import { ExpirationWatcher } from '../src/order_watcher/expiration_watcher';
import { DoneCallback, Token } from '../src/types';
-import { constants } from '../src/utils/constants';
import { utils } from '../src/utils/utils';
import { chaiSetup } from './utils/chai_setup';
+import { constants } from './utils/constants';
import { FillScenarios } from './utils/fill_scenarios';
import { reportNoErrorCallbackErrors } from './utils/report_callback_errors';
import { TokenUtils } from './utils/token_utils';
diff --git a/packages/0x.js/test/token_wrapper_test.ts b/packages/0x.js/test/token_wrapper_test.ts
index 34ebe30c2..6ecad4ccf 100644
--- a/packages/0x.js/test/token_wrapper_test.ts
+++ b/packages/0x.js/test/token_wrapper_test.ts
@@ -15,6 +15,7 @@ import {
TransferContractEventArgs,
ZeroEx,
ZeroExError,
+ ZeroExPublicNetworkConfig,
} from '../src';
import { DoneCallback } from '../src/types';
diff --git a/packages/0x.js/test/utils/constants.ts b/packages/0x.js/test/utils/constants.ts
index cf030259c..bd7841feb 100644
--- a/packages/0x.js/test/utils/constants.ts
+++ b/packages/0x.js/test/utils/constants.ts
@@ -1,8 +1,8 @@
export const constants = {
NULL_ADDRESS: '0x0000000000000000000000000000000000000000',
- ROPSTEN_NETWORK_ID: 3,
- KOVAN_NETWORK_ID: 42,
- TESTRPC_NETWORK_ID: 50,
+ ROPSTEN_NETWORK_ID: 3 as 3,
+ KOVAN_NETWORK_ID: 42 as 42,
+ TESTRPC_NETWORK_ID: 50 as 50,
KOVAN_RPC_URL: 'https://kovan.infura.io/',
ROPSTEN_RPC_URL: 'https://ropsten.infura.io/',
ZRX_DECIMALS: 18,