aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-09-05 16:07:16 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-09-05 16:07:16 +0800
commit2b547f94a44dfed029b5559b743344d5998fa3bc (patch)
tree3c5241ba9cadcfad6ee0290b497ed6780cc9fc8b /test
parentc9e490bdaec53e3a93b5da8daaaf0b1d87d9de76 (diff)
downloaddexon-0x-contracts-2b547f94a44dfed029b5559b743344d5998fa3bc.tar
dexon-0x-contracts-2b547f94a44dfed029b5559b743344d5998fa3bc.tar.gz
dexon-0x-contracts-2b547f94a44dfed029b5559b743344d5998fa3bc.tar.bz2
dexon-0x-contracts-2b547f94a44dfed029b5559b743344d5998fa3bc.tar.lz
dexon-0x-contracts-2b547f94a44dfed029b5559b743344d5998fa3bc.tar.xz
dexon-0x-contracts-2b547f94a44dfed029b5559b743344d5998fa3bc.tar.zst
dexon-0x-contracts-2b547f94a44dfed029b5559b743344d5998fa3bc.zip
Change non-exhange contracts to also return txHash
Diffstat (limited to 'test')
-rw-r--r--test/ether_token_wrapper_test.ts6
-rw-r--r--test/exchange_wrapper_test.ts8
-rw-r--r--test/token_wrapper_test.ts3
3 files changed, 10 insertions, 7 deletions
diff --git a/test/ether_token_wrapper_test.ts b/test/ether_token_wrapper_test.ts
index 601800cd1..f50aac48b 100644
--- a/test/ether_token_wrapper_test.ts
+++ b/test/ether_token_wrapper_test.ts
@@ -52,7 +52,8 @@ describe('EtherTokenWrapper', () => {
expect(preETHBalance).to.be.bignumber.gt(0);
expect(preWETHBalance).to.be.bignumber.equal(0);
- await zeroEx.etherToken.depositAsync(depositWeiAmount, addressWithETH);
+ const txHash = await zeroEx.etherToken.depositAsync(depositWeiAmount, addressWithETH);
+ await zeroEx.awaitTransactionMinedAsync(txHash);
const postETHBalanceInWei = await (zeroEx as any)._web3Wrapper.getBalanceInWeiAsync(addressWithETH);
const postWETHBalanceInBaseUnits = await zeroEx.token.getBalanceAsync(wethContractAddress, addressWithETH);
@@ -86,7 +87,8 @@ describe('EtherTokenWrapper', () => {
expect(gasCost).to.be.bignumber.lte(MAX_REASONABLE_GAS_COST_IN_WEI);
expect(preWETHBalance).to.be.bignumber.equal(depositWeiAmount);
- await zeroEx.etherToken.withdrawAsync(depositWeiAmount, addressWithETH);
+ const txHash = await zeroEx.etherToken.withdrawAsync(depositWeiAmount, addressWithETH);
+ await zeroEx.awaitTransactionMinedAsync(txHash);
const postETHBalance = await (zeroEx as any)._web3Wrapper.getBalanceInWeiAsync(addressWithETH);
const postWETHBalanceInBaseUnits = await zeroEx.token.getBalanceAsync(wethContractAddress, addressWithETH);
diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts
index 99e61a751..990a4dca6 100644
--- a/test/exchange_wrapper_test.ts
+++ b/test/exchange_wrapper_test.ts
@@ -205,7 +205,7 @@ describe('ExchangeWrapper', () => {
);
const txHash = await zeroEx.exchange.fillOrderAsync(
signedOrder, fillTakerAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress);
- await zeroEx.awaitTransactionMined(txHash);
+ await zeroEx.awaitTransactionMinedAsync(txHash);
expect(await zeroEx.token.getBalanceAsync(zrxTokenAddress, feeRecipient))
.to.be.bignumber.equal(makerFee.plus(takerFee));
});
@@ -246,7 +246,7 @@ describe('ExchangeWrapper', () => {
it('should successfully fill multiple orders', async () => {
const txHash = await zeroEx.exchange.batchFillOrdersAsync(
orderFillBatch, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress);
- await zeroEx.awaitTransactionMined(txHash);
+ await zeroEx.awaitTransactionMinedAsync(txHash);
const filledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(signedOrderHashHex);
const anotherFilledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(anotherOrderHashHex);
expect(filledAmount).to.be.bignumber.equal(fillTakerAmount);
@@ -282,7 +282,7 @@ describe('ExchangeWrapper', () => {
const txHash = await zeroEx.exchange.fillOrdersUpToAsync(
signedOrders, fillUpToAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress,
);
- await zeroEx.awaitTransactionMined(txHash);
+ await zeroEx.awaitTransactionMinedAsync(txHash);
const filledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(signedOrderHashHex);
const anotherFilledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(anotherOrderHashHex);
expect(filledAmount).to.be.bignumber.equal(fillableAmount);
@@ -316,7 +316,7 @@ describe('ExchangeWrapper', () => {
describe('successful cancels', () => {
it('should cancel an order', async () => {
const txHash = await zeroEx.exchange.cancelOrderAsync(signedOrder, cancelAmount);
- await zeroEx.awaitTransactionMined(txHash);
+ await zeroEx.awaitTransactionMinedAsync(txHash);
const cancelledAmount = await zeroEx.exchange.getCanceledTakerAmountAsync(orderHashHex);
expect(cancelledAmount).to.be.bignumber.equal(cancelAmount);
});
diff --git a/test/token_wrapper_test.ts b/test/token_wrapper_test.ts
index e4223ffc7..68dca0769 100644
--- a/test/token_wrapper_test.ts
+++ b/test/token_wrapper_test.ts
@@ -58,7 +58,8 @@ describe('TokenWrapper', () => {
const toAddress = addressWithoutFunds;
const preBalance = await zeroEx.token.getBalanceAsync(token.address, toAddress);
expect(preBalance).to.be.bignumber.equal(0);
- await zeroEx.token.transferAsync(token.address, fromAddress, toAddress, transferAmount);
+ const txHash = await zeroEx.token.transferAsync(token.address, fromAddress, toAddress, transferAmount);
+ await zeroEx.awaitTransactionMinedAsync(txHash);
const postBalance = await zeroEx.token.getBalanceAsync(token.address, toAddress);
return expect(postBalance).to.be.bignumber.equal(transferAmount);
});