aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/test
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-12-15 20:14:57 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-12-15 20:30:19 +0800
commit274aa50d740e4f3af9e3d50468843ed19b555aa3 (patch)
tree1f2f8253615ef885283e8cf20f04ee5e0ece56c6 /packages/0x.js/test
parentc36d85a46c946b5d52164642336f39c90b732376 (diff)
downloaddexon-sol-tools-274aa50d740e4f3af9e3d50468843ed19b555aa3.tar.gz
dexon-sol-tools-274aa50d740e4f3af9e3d50468843ed19b555aa3.tar.zst
dexon-sol-tools-274aa50d740e4f3af9e3d50468843ed19b555aa3.zip
Fix 0x.js unused vars
Diffstat (limited to 'packages/0x.js/test')
-rw-r--r--packages/0x.js/test/0x.js_test.ts2
-rw-r--r--packages/0x.js/test/artifacts_test.ts2
-rw-r--r--packages/0x.js/test/event_watcher_test.ts5
-rw-r--r--packages/0x.js/test/exchange_wrapper_test.ts1
-rw-r--r--packages/0x.js/test/expiration_watcher_test.ts1
-rw-r--r--packages/0x.js/test/order_state_watcher_test.ts27
-rw-r--r--packages/0x.js/test/order_validation_test.ts5
-rw-r--r--packages/0x.js/test/remaining_fillable_calculator_test.ts1
-rw-r--r--packages/0x.js/test/subscription_test.ts8
-rw-r--r--packages/0x.js/test/token_transfer_proxy_wrapper_test.ts1
-rw-r--r--packages/0x.js/test/token_wrapper_test.ts9
11 files changed, 3 insertions, 59 deletions
diff --git a/packages/0x.js/test/0x.js_test.ts b/packages/0x.js/test/0x.js_test.ts
index 52f9566dc..e1ceb12c8 100644
--- a/packages/0x.js/test/0x.js_test.ts
+++ b/packages/0x.js/test/0x.js_test.ts
@@ -5,7 +5,7 @@ import * as _ from 'lodash';
import 'mocha';
import * as Sinon from 'sinon';
-import {ApprovalContractEventArgs, LogWithDecodedArgs, Order, TokenEvents, ZeroEx, ZeroExError} from '../src';
+import {ApprovalContractEventArgs, LogWithDecodedArgs, Order, TokenEvents, ZeroEx} from '../src';
import {chaiSetup} from './utils/chai_setup';
import {constants} from './utils/constants';
diff --git a/packages/0x.js/test/artifacts_test.ts b/packages/0x.js/test/artifacts_test.ts
index f4599a24d..d12346db3 100644
--- a/packages/0x.js/test/artifacts_test.ts
+++ b/packages/0x.js/test/artifacts_test.ts
@@ -1,4 +1,3 @@
-import * as chai from 'chai';
import * as fs from 'fs';
import HDWalletProvider = require('truffle-hdwallet-provider');
@@ -8,7 +7,6 @@ import {chaiSetup} from './utils/chai_setup';
import {constants} from './utils/constants';
chaiSetup.configure();
-const expect = chai.expect;
// Those tests are slower cause they're talking to a remote node
const TIMEOUT = 10000;
diff --git a/packages/0x.js/test/event_watcher_test.ts b/packages/0x.js/test/event_watcher_test.ts
index 3d92c62a3..95af99268 100644
--- a/packages/0x.js/test/event_watcher_test.ts
+++ b/packages/0x.js/test/event_watcher_test.ts
@@ -1,5 +1,4 @@
import {Web3Wrapper} from '@0xproject/web3-wrapper';
-import BigNumber from 'bignumber.js';
import * as chai from 'chai';
import * as _ from 'lodash';
import 'mocha';
@@ -7,15 +6,12 @@ import * as Sinon from 'sinon';
import * as Web3 from 'web3';
import {
- DecodedLogEvent,
LogEvent,
- ZeroEx,
} from '../src';
import {EventWatcher} from '../src/order_watcher/event_watcher';
import {DoneCallback} from '../src/types';
import {chaiSetup} from './utils/chai_setup';
-import {constants} from './utils/constants';
import {web3Factory} from './utils/web3_factory';
chaiSetup.configure();
@@ -26,7 +22,6 @@ describe('EventWatcher', () => {
let stubs: Sinon.SinonStub[] = [];
let eventWatcher: EventWatcher;
let web3Wrapper: Web3Wrapper;
- const numConfirmations = 0;
const logA: Web3.LogEntry = {
address: '0x71d271f8b14adef568f8f28f1587ce7271ac4ca5',
blockHash: null,
diff --git a/packages/0x.js/test/exchange_wrapper_test.ts b/packages/0x.js/test/exchange_wrapper_test.ts
index dea961026..51b511dbf 100644
--- a/packages/0x.js/test/exchange_wrapper_test.ts
+++ b/packages/0x.js/test/exchange_wrapper_test.ts
@@ -9,7 +9,6 @@ import {
ExchangeContractErrs,
ExchangeEvents,
LogCancelContractEventArgs,
- LogEvent,
LogFillContractEventArgs,
OrderCancellationRequest,
OrderFillRequest,
diff --git a/packages/0x.js/test/expiration_watcher_test.ts b/packages/0x.js/test/expiration_watcher_test.ts
index c1618ce9d..30c395f00 100644
--- a/packages/0x.js/test/expiration_watcher_test.ts
+++ b/packages/0x.js/test/expiration_watcher_test.ts
@@ -1,5 +1,4 @@
import {BlockchainLifecycle} from '@0xproject/dev-utils';
-import {Web3Wrapper} from '@0xproject/web3-wrapper';
import BigNumber from 'bignumber.js';
import * as chai from 'chai';
import * as _ from 'lodash';
diff --git a/packages/0x.js/test/order_state_watcher_test.ts b/packages/0x.js/test/order_state_watcher_test.ts
index 99e6646a3..4d9a96502 100644
--- a/packages/0x.js/test/order_state_watcher_test.ts
+++ b/packages/0x.js/test/order_state_watcher_test.ts
@@ -1,5 +1,4 @@
import {BlockchainLifecycle} from '@0xproject/dev-utils';
-import {Web3Wrapper} from '@0xproject/web3-wrapper';
import BigNumber from 'bignumber.js';
import * as chai from 'chai';
import * as _ from 'lodash';
@@ -7,19 +6,15 @@ import 'mocha';
import * as Web3 from 'web3';
import {
- DecodedLogEvent,
ExchangeContractErrs,
- LogEvent,
OrderState,
OrderStateInvalid,
OrderStateValid,
SignedOrder,
Token,
ZeroEx,
- ZeroExConfig,
ZeroExError,
} from '../src';
-import {OrderStateWatcher} from '../src/order_watcher/order_state_watcher';
import {DoneCallback} from '../src/types';
import {chaiSetup} from './utils/chai_setup';
@@ -48,7 +43,6 @@ describe('OrderStateWatcher', () => {
let takerToken: Token;
let maker: string;
let taker: string;
- let web3Wrapper: Web3Wrapper;
let signedOrder: SignedOrder;
const config = {
networkId: constants.TESTRPC_NETWORK_ID,
@@ -67,7 +61,6 @@ describe('OrderStateWatcher', () => {
fillScenarios = new FillScenarios(zeroEx, userAddresses, tokens, zrxTokenAddress, exchangeContractAddress);
await fillScenarios.initTokenBalancesAsync();
[makerToken, takerToken] = tokenUtils.getDummyTokens();
- web3Wrapper = (zeroEx as any)._web3Wrapper;
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
@@ -142,7 +135,6 @@ describe('OrderStateWatcher', () => {
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerToken.address, takerToken.address, maker, taker, fillableAmount,
);
- const orderHash = ZeroEx.getOrderHashHex(signedOrder);
zeroEx.orderStateWatcher.addOrder(signedOrder);
const callback = reportCallbackErrors(done)((orderState: OrderState) => {
throw new Error('OrderState callback fired for irrelevant order');
@@ -151,7 +143,6 @@ describe('OrderStateWatcher', () => {
const notTheMaker = userAddresses[0];
const anyRecipient = taker;
const transferAmount = new BigNumber(2);
- const notTheMakerBalance = await zeroEx.token.getBalanceAsync(makerToken.address, notTheMaker);
await zeroEx.token.transferAsync(makerToken.address, notTheMaker, anyRecipient, transferAmount);
setTimeout(() => {
done();
@@ -208,8 +199,6 @@ describe('OrderStateWatcher', () => {
);
const makerBalance = await zeroEx.token.getBalanceAsync(makerToken.address, maker);
- const takerBalance = await zeroEx.token.getBalanceAsync(makerToken.address, taker);
-
const fillAmountInBaseUnits = new BigNumber(2);
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
zeroEx.orderStateWatcher.addOrder(signedOrder);
@@ -242,8 +231,6 @@ describe('OrderStateWatcher', () => {
signedOrder = await fillScenarios.createFillableSignedOrderWithFeesAsync(
makerToken.address, takerToken.address, makerFee, takerFee, maker, taker, fillableAmount,
taker);
- const orderHash = ZeroEx.getOrderHashHex(signedOrder);
- zeroEx.orderStateWatcher.addOrder(signedOrder);
const callback = reportCallbackErrors(done)((orderState: OrderState) => {
done();
});
@@ -260,8 +247,6 @@ describe('OrderStateWatcher', () => {
makerToken.address, takerToken.address, maker, taker, makerFillableAmount,
takerFillableAmount,
);
- const makerBalance = await zeroEx.token.getBalanceAsync(makerToken.address, maker);
- const takerBalance = await zeroEx.token.getBalanceAsync(makerToken.address, taker);
const fillAmountInBaseUnits = ZeroEx.toBaseUnitAmount(new BigNumber(2), decimals);
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
zeroEx.orderStateWatcher.addOrder(signedOrder);
@@ -289,8 +274,6 @@ describe('OrderStateWatcher', () => {
makerToken.address, takerToken.address, maker, taker, fillableAmount,
);
- const makerBalance = await zeroEx.token.getBalanceAsync(makerToken.address, maker);
-
const changedMakerApprovalAmount = ZeroEx.toBaseUnitAmount(new BigNumber(3), decimals);
zeroEx.orderStateWatcher.addOrder(signedOrder);
@@ -343,8 +326,6 @@ describe('OrderStateWatcher', () => {
makerToken.address, takerToken.address, makerFee, takerFee, maker,
taker, fillableAmount, feeRecipient);
- const makerBalance = await zeroEx.token.getBalanceAsync(makerToken.address, maker);
-
const remainingTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(4), decimals);
const transferTokenAmount = makerFee.sub(remainingTokenAmount);
zeroEx.orderStateWatcher.addOrder(signedOrder);
@@ -370,10 +351,7 @@ describe('OrderStateWatcher', () => {
makerToken.address, takerToken.address, makerFee, takerFee, maker,
taker, fillableAmount, feeRecipient);
- const makerBalance = await zeroEx.token.getBalanceAsync(makerToken.address, maker);
-
const remainingFeeAmount = ZeroEx.toBaseUnitAmount(new BigNumber(3), decimals);
- const transferFeeAmount = makerFee.sub(remainingFeeAmount);
const remainingTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(4), decimals);
const transferTokenAmount = makerFee.sub(remainingTokenAmount);
@@ -401,7 +379,6 @@ describe('OrderStateWatcher', () => {
makerToken.address, takerToken.address, makerFee, takerFee, maker,
taker, fillableAmount, feeRecipient);
- const makerBalance = await zeroEx.token.getBalanceAsync(makerToken.address, maker);
zeroEx.orderStateWatcher.addOrder(signedOrder);
const callback = reportCallbackErrors(done)((orderState: OrderState) => {
@@ -434,7 +411,6 @@ describe('OrderStateWatcher', () => {
});
zeroEx.orderStateWatcher.subscribe(callback);
- const shouldThrowOnInsufficientBalanceOrAllowance = true;
await zeroEx.exchange.cancelOrderAsync(signedOrder, fillableAmount);
})().catch(done);
});
@@ -466,9 +442,6 @@ describe('OrderStateWatcher', () => {
makerToken.address, takerToken.address, maker, taker, fillableAmount,
);
- const makerBalance = await zeroEx.token.getBalanceAsync(makerToken.address, maker);
- const takerBalance = await zeroEx.token.getBalanceAsync(makerToken.address, taker);
-
const cancelAmountInBaseUnits = new BigNumber(2);
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
zeroEx.orderStateWatcher.addOrder(signedOrder);
diff --git a/packages/0x.js/test/order_validation_test.ts b/packages/0x.js/test/order_validation_test.ts
index c6d5d3392..b36a513fe 100644
--- a/packages/0x.js/test/order_validation_test.ts
+++ b/packages/0x.js/test/order_validation_test.ts
@@ -34,7 +34,6 @@ describe('OrderValidation', () => {
let makerAddress: string;
let takerAddress: string;
let feeRecipient: string;
- let orderValidationUtils: OrderValidationUtils;
const fillableAmount = new BigNumber(5);
const fillTakerAmount = new BigNumber(5);
const config = {
@@ -53,7 +52,6 @@ describe('OrderValidation', () => {
const [makerToken, takerToken] = tokenUtils.getDummyTokens();
makerTokenAddress = makerToken.address;
takerTokenAddress = takerToken.address;
- orderValidationUtils = new OrderValidationUtils(zeroEx.token, zeroEx.exchange);
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
@@ -181,7 +179,6 @@ describe('OrderValidation', () => {
});
describe('validateCancelOrderAndThrowIfInvalidAsync', () => {
let signedOrder: SignedOrder;
- let orderHashHex: string;
const cancelAmount = new BigNumber(3);
beforeEach(async () => {
[coinbase, makerAddress, takerAddress] = userAddresses;
@@ -191,7 +188,6 @@ describe('OrderValidation', () => {
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, fillableAmount,
);
- orderHashHex = ZeroEx.getOrderHashHex(signedOrder);
});
it('should throw when cancel amount is zero', async () => {
const zeroCancelAmount = new BigNumber(0);
@@ -204,7 +200,6 @@ describe('OrderValidation', () => {
makerTokenAddress, takerTokenAddress, makerAddress, takerAddress,
fillableAmount, expirationInPast,
);
- orderHashHex = ZeroEx.getOrderHashHex(expiredSignedOrder);
return expect(zeroEx.exchange.validateCancelOrderThrowIfInvalidAsync(expiredSignedOrder, cancelAmount))
.to.be.rejectedWith(ExchangeContractErrs.OrderCancelExpired);
});
diff --git a/packages/0x.js/test/remaining_fillable_calculator_test.ts b/packages/0x.js/test/remaining_fillable_calculator_test.ts
index 610bf9b1a..47ba13cd7 100644
--- a/packages/0x.js/test/remaining_fillable_calculator_test.ts
+++ b/packages/0x.js/test/remaining_fillable_calculator_test.ts
@@ -7,7 +7,6 @@ import { RemainingFillableCalculator } from '../src/order_watcher/remaining_fill
import { ECSignature, SignedOrder } from '../src/types';
import { chaiSetup } from './utils/chai_setup';
-import { TokenUtils } from './utils/token_utils';
chaiSetup.configure();
const expect = chai.expect;
diff --git a/packages/0x.js/test/subscription_test.ts b/packages/0x.js/test/subscription_test.ts
index d280d720a..43e6b63b6 100644
--- a/packages/0x.js/test/subscription_test.ts
+++ b/packages/0x.js/test/subscription_test.ts
@@ -12,14 +12,12 @@ import {
Token,
TokenEvents,
ZeroEx,
- ZeroExError,
} from '../src';
-import {BlockParamLiteral, DoneCallback} from '../src/types';
+import {DoneCallback} from '../src/types';
import {chaiSetup} from './utils/chai_setup';
import {constants} from './utils/constants';
import {reportCallbackErrors} from './utils/report_callback_errors';
-import {TokenUtils} from './utils/token_utils';
import {web3Factory} from './utils/web3_factory';
chaiSetup.configure();
@@ -31,7 +29,6 @@ describe('SubscriptionTest', () => {
let zeroEx: ZeroEx;
let userAddresses: string[];
let tokens: Token[];
- let tokenUtils: TokenUtils;
let coinbase: string;
let addressWithoutFunds: string;
const config = {
@@ -42,7 +39,6 @@ describe('SubscriptionTest', () => {
zeroEx = new ZeroEx(web3.currentProvider, config);
userAddresses = await zeroEx.getAvailableAddressesAsync();
tokens = await zeroEx.tokenRegistry.getTokensAsync();
- tokenUtils = new TokenUtils(tokens);
coinbase = userAddresses[0];
addressWithoutFunds = userAddresses[1];
});
@@ -54,9 +50,7 @@ describe('SubscriptionTest', () => {
});
describe('#subscribe', () => {
const indexFilterValues = {};
- const shouldThrowOnInsufficientBalanceOrAllowance = true;
let tokenAddress: string;
- const transferAmount = new BigNumber(42);
const allowanceAmount = new BigNumber(42);
let stubs: Sinon.SinonStub[] = [];
before(() => {
diff --git a/packages/0x.js/test/token_transfer_proxy_wrapper_test.ts b/packages/0x.js/test/token_transfer_proxy_wrapper_test.ts
index 05861d112..9674b64ac 100644
--- a/packages/0x.js/test/token_transfer_proxy_wrapper_test.ts
+++ b/packages/0x.js/test/token_transfer_proxy_wrapper_test.ts
@@ -1,7 +1,6 @@
import * as chai from 'chai';
import {ZeroEx} from '../src';
-import {TokenTransferProxyWrapper} from '../src/contract_wrappers/token_transfer_proxy_wrapper';
import {chaiSetup} from './utils/chai_setup';
import {constants} from './utils/constants';
diff --git a/packages/0x.js/test/token_wrapper_test.ts b/packages/0x.js/test/token_wrapper_test.ts
index 1ee2b25fc..70637dbfe 100644
--- a/packages/0x.js/test/token_wrapper_test.ts
+++ b/packages/0x.js/test/token_wrapper_test.ts
@@ -1,5 +1,4 @@
import {BlockchainLifecycle} from '@0xproject/dev-utils';
-import {promisify} from '@0xproject/utils';
import {Web3Wrapper} from '@0xproject/web3-wrapper';
import BigNumber from 'bignumber.js';
import * as chai from 'chai';
@@ -8,13 +7,9 @@ import * as Web3 from 'web3';
import {
ApprovalContractEventArgs,
- ContractEvent,
DecodedLogEvent,
- LogEvent,
- LogWithDecodedArgs,
SubscriptionOpts,
Token,
- TokenContractEventArgs,
TokenEvents,
TransferContractEventArgs,
ZeroEx,
@@ -71,8 +66,7 @@ describe('TokenWrapper', () => {
const toAddress = addressWithoutFunds;
const preBalance = await zeroEx.token.getBalanceAsync(token.address, toAddress);
expect(preBalance).to.be.bignumber.equal(0);
- const txHash = await zeroEx.token.transferAsync(token.address, fromAddress, toAddress, transferAmount);
- const receipt = await zeroEx.awaitTransactionMinedAsync(txHash);
+ await zeroEx.token.transferAsync(token.address, fromAddress, toAddress, transferAmount);
const postBalance = await zeroEx.token.getBalanceAsync(token.address, toAddress);
return expect(postBalance).to.be.bignumber.equal(transferAmount);
});
@@ -354,7 +348,6 @@ describe('TokenWrapper', () => {
});
describe('#subscribe', () => {
const indexFilterValues = {};
- const shouldThrowOnInsufficientBalanceOrAllowance = true;
let tokenAddress: string;
const transferAmount = new BigNumber(42);
const allowanceAmount = new BigNumber(42);