appease static tests

This commit is contained in:
Michael Zhu 2019-10-04 10:02:50 -07:00
parent c17984b74f
commit cf517b1459
3 changed files with 17 additions and 20 deletions

View File

@ -18,7 +18,7 @@ import {
import { assetDataUtils, CoordinatorRevertErrors, transactionHashUtils } from '@0x/order-utils'; import { assetDataUtils, CoordinatorRevertErrors, transactionHashUtils } from '@0x/order-utils';
import { BigNumber } from '@0x/utils'; import { BigNumber } from '@0x/utils';
import { ApprovalFactory, artifacts, CoordinatorTestFactory, CoordinatorContract } from '../src'; import { ApprovalFactory, artifacts, CoordinatorContract, CoordinatorTestFactory } from '../src';
// tslint:disable:no-unnecessary-type-assertion // tslint:disable:no-unnecessary-type-assertion
blockchainTests.resets('Coordinator tests', env => { blockchainTests.resets('Coordinator tests', env => {

View File

@ -31,6 +31,17 @@ export class CoordinatorTestFactory {
}); });
} }
private static _expectedCancelEvent(order: SignedOrder): ExchangeCancelEventArgs {
return {
makerAddress: order.makerAddress,
senderAddress: order.senderAddress,
feeRecipientAddress: order.feeRecipientAddress,
makerAssetData: order.makerAssetData,
takerAssetData: order.takerAssetData,
orderHash: orderHashUtils.getOrderHashHex(order),
};
}
constructor( constructor(
private readonly _coordinatorContract: CoordinatorContract, private readonly _coordinatorContract: CoordinatorContract,
private readonly _erc20Wrapper: ERC20Wrapper, private readonly _erc20Wrapper: ERC20Wrapper,
@ -65,7 +76,7 @@ export class CoordinatorTestFactory {
txData: Partial<TxData>, txData: Partial<TxData>,
revertError?: RevertError, revertError?: RevertError,
): Promise<void> { ): Promise<void> {
const initBalances = await this._getTokenBalances(); const initBalances = await this._getTokenBalancesAsync();
const tx = this._coordinatorContract.executeTransaction.awaitTransactionSuccessAsync( const tx = this._coordinatorContract.executeTransaction.awaitTransactionSuccessAsync(
transaction, transaction,
txOrigin, txOrigin,
@ -124,8 +135,8 @@ export class CoordinatorTestFactory {
} }
} }
private async _getTokenBalances(): Promise<TokenBalances> { private async _getTokenBalancesAsync(): Promise<TokenBalances> {
let erc20Balances = await this._erc20Wrapper.getBalancesAsync(); const erc20Balances = await this._erc20Wrapper.getBalancesAsync();
const ethBalances = _.zipObject( const ethBalances = _.zipObject(
this._addresses, this._addresses,
await Promise.all(this._addresses.map(address => web3Wrapper.getBalanceInWeiAsync(address))), await Promise.all(this._addresses.map(address => web3Wrapper.getBalanceInWeiAsync(address))),
@ -208,7 +219,7 @@ export class CoordinatorTestFactory {
private async _verifyBalancesAsync(expectedBalances: TokenBalances): Promise<void> { private async _verifyBalancesAsync(expectedBalances: TokenBalances): Promise<void> {
const { erc20: expectedErc20Balances, eth: expectedEthBalances } = expectedBalances; const { erc20: expectedErc20Balances, eth: expectedEthBalances } = expectedBalances;
const { erc20: actualErc20Balances, eth: actualEthBalances } = await this._getTokenBalances(); const { erc20: actualErc20Balances, eth: actualEthBalances } = await this._getTokenBalancesAsync();
const ownersByName = { const ownersByName = {
maker: this._makerAddress, maker: this._makerAddress,
taker: this._takerAddress, taker: this._takerAddress,
@ -254,15 +265,4 @@ export class CoordinatorTestFactory {
orderHash: orderHashUtils.getOrderHashHex(order), orderHash: orderHashUtils.getOrderHashHex(order),
}; };
} }
private static _expectedCancelEvent(order: SignedOrder): ExchangeCancelEventArgs {
return {
makerAddress: order.makerAddress,
senderAddress: order.senderAddress,
feeRecipientAddress: order.feeRecipientAddress,
makerAssetData: order.makerAssetData,
takerAssetData: order.takerAssetData,
orderHash: orderHashUtils.getOrderHashHex(order),
};
}
} }

View File

@ -24,10 +24,7 @@ export const constants = {
ExchangeFunctionName.MarketBuyOrdersNoThrow, ExchangeFunctionName.MarketBuyOrdersNoThrow,
ExchangeFunctionName.MarketSellOrdersNoThrow, ExchangeFunctionName.MarketSellOrdersNoThrow,
], ],
MATCH_ORDER_FN_NAMES: [ MATCH_ORDER_FN_NAMES: [ExchangeFunctionName.MatchOrders, ExchangeFunctionName.MatchOrdersWithMaximalFill],
ExchangeFunctionName.MatchOrders,
ExchangeFunctionName.MatchOrdersWithMaximalFill,
],
BATCH_MATCH_ORDER_FN_NAMES: [ BATCH_MATCH_ORDER_FN_NAMES: [
ExchangeFunctionName.BatchMatchOrders, ExchangeFunctionName.BatchMatchOrders,
ExchangeFunctionName.BatchMatchOrdersWithMaximalFill, ExchangeFunctionName.BatchMatchOrdersWithMaximalFill,