aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers/test
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contract-wrappers/test')
-rw-r--r--packages/contract-wrappers/test/erc20_wrapper_test.ts3
-rw-r--r--packages/contract-wrappers/test/erc721_wrapper_test.ts3
-rw-r--r--packages/contract-wrappers/test/ether_token_wrapper_test.ts14
-rw-r--r--packages/contract-wrappers/test/exchange_wrapper_test.ts14
-rw-r--r--packages/contract-wrappers/test/global_hooks.ts2
-rw-r--r--packages/contract-wrappers/test/subscription_test.ts38
6 files changed, 19 insertions, 55 deletions
diff --git a/packages/contract-wrappers/test/erc20_wrapper_test.ts b/packages/contract-wrappers/test/erc20_wrapper_test.ts
index 0011508e0..cf7ac527e 100644
--- a/packages/contract-wrappers/test/erc20_wrapper_test.ts
+++ b/packages/contract-wrappers/test/erc20_wrapper_test.ts
@@ -1,11 +1,10 @@
import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils';
-import { EmptyWalletSubprovider } from '@0xproject/subproviders';
+import { EmptyWalletSubprovider, Web3ProviderEngine } from '@0xproject/subproviders';
import { DoneCallback } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import { Provider } from 'ethereum-types';
import 'mocha';
-import Web3ProviderEngine = require('web3-provider-engine');
import {
BlockParamLiteral,
diff --git a/packages/contract-wrappers/test/erc721_wrapper_test.ts b/packages/contract-wrappers/test/erc721_wrapper_test.ts
index 96b8fcf1d..f005ac2e0 100644
--- a/packages/contract-wrappers/test/erc721_wrapper_test.ts
+++ b/packages/contract-wrappers/test/erc721_wrapper_test.ts
@@ -1,11 +1,10 @@
import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils';
-import { EmptyWalletSubprovider } from '@0xproject/subproviders';
+import { EmptyWalletSubprovider, Web3ProviderEngine } from '@0xproject/subproviders';
import { DoneCallback } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import { Provider } from 'ethereum-types';
import 'mocha';
-import Web3ProviderEngine = require('web3-provider-engine');
import {
BlockParamLiteral,
diff --git a/packages/contract-wrappers/test/ether_token_wrapper_test.ts b/packages/contract-wrappers/test/ether_token_wrapper_test.ts
index 0a860884a..48bd6d3f6 100644
--- a/packages/contract-wrappers/test/ether_token_wrapper_test.ts
+++ b/packages/contract-wrappers/test/ether_token_wrapper_test.ts
@@ -336,15 +336,19 @@ describe('EtherTokenWrapper', () => {
describe('#getLogsAsync', () => {
let etherTokenAddress: string;
let erc20ProxyAddress: string;
- const blockRange: BlockRange = {
- fromBlock: 0,
- toBlock: BlockParamLiteral.Latest,
- };
+ let blockRange: BlockRange;
let txHash: string;
- before(() => {
+ before(async () => {
addressWithETH = userAddresses[0];
etherTokenAddress = tokenUtils.getWethTokenAddress();
erc20ProxyAddress = contractWrappers.erc20Proxy.getContractAddress();
+ // Start the block range after all migrations to avoid unexpected logs
+ const currentBlock = await web3Wrapper.getBlockNumberAsync();
+ const fromBlock = currentBlock + 1;
+ blockRange = {
+ fromBlock,
+ toBlock: BlockParamLiteral.Latest,
+ };
});
it('should get logs with decoded args emitted by Approval', async () => {
txHash = await contractWrappers.erc20Token.setUnlimitedProxyAllowanceAsync(
diff --git a/packages/contract-wrappers/test/exchange_wrapper_test.ts b/packages/contract-wrappers/test/exchange_wrapper_test.ts
index b2c716008..dca212f65 100644
--- a/packages/contract-wrappers/test/exchange_wrapper_test.ts
+++ b/packages/contract-wrappers/test/exchange_wrapper_test.ts
@@ -1,6 +1,6 @@
import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils';
import { FillScenarios } from '@0xproject/fill-scenarios';
-import { assetProxyUtils, orderHashUtils } from '@0xproject/order-utils';
+import { assetDataUtils, orderHashUtils } from '@0xproject/order-utils';
import { DoneCallback, SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
@@ -53,7 +53,6 @@ describe('ExchangeWrapper', () => {
await blockchainLifecycle.startAsync();
contractWrappers = new ContractWrappers(provider, config);
exchangeContractAddress = contractWrappers.exchange.getContractAddress();
- const erc20ProxyAddress = contractWrappers.erc20Proxy.getContractAddress();
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
zrxTokenAddress = tokenUtils.getProtocolTokenAddress();
fillScenarios = new FillScenarios(
@@ -61,13 +60,14 @@ describe('ExchangeWrapper', () => {
userAddresses,
zrxTokenAddress,
exchangeContractAddress,
- erc20ProxyAddress,
+ contractWrappers.erc20Proxy.getContractAddress(),
+ contractWrappers.erc721Proxy.getContractAddress(),
);
[coinbase, makerAddress, takerAddress, feeRecipient, anotherMakerAddress] = userAddresses;
[makerTokenAddress, takerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses();
[makerAssetData, takerAssetData] = [
- assetProxyUtils.encodeERC20AssetData(makerTokenAddress),
- assetProxyUtils.encodeERC20AssetData(takerTokenAddress),
+ assetDataUtils.encodeERC20AssetData(makerTokenAddress),
+ assetDataUtils.encodeERC20AssetData(takerTokenAddress),
];
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerAssetData,
@@ -264,8 +264,8 @@ describe('ExchangeWrapper', () => {
});
});
describe('#getZRXAssetData', () => {
- it('should get the asset data', async () => {
- const ZRX_ASSET_DATA = await contractWrappers.exchange.getZRXAssetDataAsync();
+ it('should get the asset data', () => {
+ const ZRX_ASSET_DATA = contractWrappers.exchange.getZRXAssetData();
const ASSET_DATA_HEX_LENGTH = 74;
expect(ZRX_ASSET_DATA).to.have.length(ASSET_DATA_HEX_LENGTH);
});
diff --git a/packages/contract-wrappers/test/global_hooks.ts b/packages/contract-wrappers/test/global_hooks.ts
index bf80e0908..05b23d5b8 100644
--- a/packages/contract-wrappers/test/global_hooks.ts
+++ b/packages/contract-wrappers/test/global_hooks.ts
@@ -7,7 +7,7 @@ before('migrate contracts', async function(): Promise<void> {
// HACK: Since the migrations take longer then our global mocha timeout limit
// we manually increase it for this before hook.
const mochaTestTimeoutMs = 50000;
- this.timeout(mochaTestTimeoutMs);
+ this.timeout(mochaTestTimeoutMs); // tslint:disable-line:no-invalid-this
const txDefaults = {
gas: devConstants.GAS_LIMIT,
from: devConstants.TESTRPC_FIRST_ADDRESS,
diff --git a/packages/contract-wrappers/test/subscription_test.ts b/packages/contract-wrappers/test/subscription_test.ts
index adda4ab78..80d17576f 100644
--- a/packages/contract-wrappers/test/subscription_test.ts
+++ b/packages/contract-wrappers/test/subscription_test.ts
@@ -49,44 +49,6 @@ describe('SubscriptionTest', () => {
_.each(stubs, s => s.restore());
stubs = [];
});
- it('Should receive the Error when an error occurs while fetching the block', (done: DoneCallback) => {
- (async () => {
- const errMsg = 'Error fetching block';
- const callback = callbackErrorReporter.assertNodeCallbackError(done, errMsg);
- stubs = [Sinon.stub((contractWrappers as any)._web3Wrapper, 'getBlockAsync').throws(new Error(errMsg))];
- contractWrappers.erc20Token.subscribe(
- tokenAddress,
- ERC20TokenEvents.Approval,
- indexFilterValues,
- callback,
- );
- await contractWrappers.erc20Token.setAllowanceAsync(
- tokenAddress,
- coinbase,
- addressWithoutFunds,
- allowanceAmount,
- );
- })().catch(done);
- });
- it('Should receive the Error when an error occurs while reconciling the new block', (done: DoneCallback) => {
- (async () => {
- const errMsg = 'Error fetching logs';
- const callback = callbackErrorReporter.assertNodeCallbackError(done, errMsg);
- stubs = [Sinon.stub((contractWrappers as any)._web3Wrapper, 'getLogsAsync').throws(new Error(errMsg))];
- contractWrappers.erc20Token.subscribe(
- tokenAddress,
- ERC20TokenEvents.Approval,
- indexFilterValues,
- callback,
- );
- await contractWrappers.erc20Token.setAllowanceAsync(
- tokenAddress,
- coinbase,
- addressWithoutFunds,
- allowanceAmount,
- );
- })().catch(done);
- });
it('Should allow unsubscribeAll to be called successfully after an error', (done: DoneCallback) => {
(async () => {
const callback = (err: Error | null, _logEvent?: DecodedLogEvent<ERC20TokenApprovalEventArgs>) =>