aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers/test
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-06-29 21:41:58 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-06-29 22:52:55 +0800
commit5dea432ebf27cf35cb85823c8f7fdc81fe8ae4f6 (patch)
tree88c312292b8b5349efe3317bd1e7f1b32e0387f5 /packages/contract-wrappers/test
parent016d82d766d2a15d02b2e93cf2d02a2a59e1feb4 (diff)
downloaddexon-sol-tools-5dea432ebf27cf35cb85823c8f7fdc81fe8ae4f6.tar
dexon-sol-tools-5dea432ebf27cf35cb85823c8f7fdc81fe8ae4f6.tar.gz
dexon-sol-tools-5dea432ebf27cf35cb85823c8f7fdc81fe8ae4f6.tar.bz2
dexon-sol-tools-5dea432ebf27cf35cb85823c8f7fdc81fe8ae4f6.tar.lz
dexon-sol-tools-5dea432ebf27cf35cb85823c8f7fdc81fe8ae4f6.tar.xz
dexon-sol-tools-5dea432ebf27cf35cb85823c8f7fdc81fe8ae4f6.tar.zst
dexon-sol-tools-5dea432ebf27cf35cb85823c8f7fdc81fe8ae4f6.zip
Set the interval to 0 in awaitTranscationSuccessAsync
Diffstat (limited to 'packages/contract-wrappers/test')
-rw-r--r--packages/contract-wrappers/test/erc20_wrapper_test.ts8
-rw-r--r--packages/contract-wrappers/test/erc721_wrapper_test.ts29
-rw-r--r--packages/contract-wrappers/test/ether_token_wrapper_test.ts12
-rw-r--r--packages/contract-wrappers/test/utils/constants.ts1
4 files changed, 28 insertions, 22 deletions
diff --git a/packages/contract-wrappers/test/erc20_wrapper_test.ts b/packages/contract-wrappers/test/erc20_wrapper_test.ts
index 6539a0cbf..dd15a9b82 100644
--- a/packages/contract-wrappers/test/erc20_wrapper_test.ts
+++ b/packages/contract-wrappers/test/erc20_wrapper_test.ts
@@ -592,7 +592,7 @@ describe('ERC20Wrapper', () => {
});
it('should get logs with decoded args emitted by Approval', async () => {
txHash = await contractWrappers.erc20Token.setUnlimitedProxyAllowanceAsync(tokenAddress, coinbase);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
const eventName = ERC20TokenEvents.Approval;
const indexFilterValues = {};
const logs = await contractWrappers.erc20Token.getLogsAsync<ERC20TokenApprovalEventArgs>(
@@ -610,7 +610,7 @@ describe('ERC20Wrapper', () => {
});
it('should only get the logs with the correct event name', async () => {
txHash = await contractWrappers.erc20Token.setUnlimitedProxyAllowanceAsync(tokenAddress, coinbase);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
const differentEventName = ERC20TokenEvents.Transfer;
const indexFilterValues = {};
const logs = await contractWrappers.erc20Token.getLogsAsync(
@@ -623,12 +623,12 @@ describe('ERC20Wrapper', () => {
});
it('should only get the logs with the correct indexed fields', async () => {
txHash = await contractWrappers.erc20Token.setUnlimitedProxyAllowanceAsync(tokenAddress, coinbase);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
txHash = await contractWrappers.erc20Token.setUnlimitedProxyAllowanceAsync(
tokenAddress,
addressWithoutFunds,
);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
const eventName = ERC20TokenEvents.Approval;
const indexFilterValues = {
_owner: coinbase,
diff --git a/packages/contract-wrappers/test/erc721_wrapper_test.ts b/packages/contract-wrappers/test/erc721_wrapper_test.ts
index 7d976c210..78bad2915 100644
--- a/packages/contract-wrappers/test/erc721_wrapper_test.ts
+++ b/packages/contract-wrappers/test/erc721_wrapper_test.ts
@@ -64,7 +64,7 @@ describe('ERC721Wrapper', () => {
it('should successfully transfer tokens when sender is an approved address', async () => {
const tokenId = await tokenUtils.mintDummyERC721Async(tokenAddress, ownerAddress);
let txHash = await contractWrappers.erc721Token.setApprovalAsync(tokenAddress, approvedAddress, tokenId);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
const owner = await contractWrappers.erc721Token.getOwnerOfAsync(tokenAddress, tokenId);
expect(owner).to.be.equal(ownerAddress);
txHash = await contractWrappers.erc721Token.transferFromAsync(
@@ -73,7 +73,7 @@ describe('ERC721Wrapper', () => {
approvedAddress,
tokenId,
);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
const newOwner = await contractWrappers.erc721Token.getOwnerOfAsync(tokenAddress, tokenId);
expect(newOwner).to.be.equal(receiverAddress);
});
@@ -86,7 +86,7 @@ describe('ERC721Wrapper', () => {
operatorAddress,
isApprovedForAll,
);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
const owner = await contractWrappers.erc721Token.getOwnerOfAsync(tokenAddress, tokenId);
expect(owner).to.be.equal(ownerAddress);
txHash = await contractWrappers.erc721Token.transferFromAsync(
@@ -95,7 +95,7 @@ describe('ERC721Wrapper', () => {
operatorAddress,
tokenId,
);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
const newOwner = await contractWrappers.erc721Token.getOwnerOfAsync(tokenAddress, tokenId);
expect(newOwner).to.be.equal(receiverAddress);
});
@@ -172,7 +172,7 @@ describe('ERC721Wrapper', () => {
operatorAddress,
true,
);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
isApprovedForAll = await contractWrappers.erc721Token.isApprovedForAllAsync(
tokenAddress,
ownerAddress,
@@ -186,7 +186,7 @@ describe('ERC721Wrapper', () => {
operatorAddress,
false,
);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
isApprovedForAll = await contractWrappers.erc721Token.isApprovedForAllAsync(
tokenAddress,
ownerAddress,
@@ -202,7 +202,7 @@ describe('ERC721Wrapper', () => {
ownerAddress,
true,
);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
const isApprovedForAll = await contractWrappers.erc721Token.isProxyApprovedForAllAsync(
tokenAddress,
ownerAddress,
@@ -268,6 +268,7 @@ describe('ERC721Wrapper', () => {
operatorAddress,
isApprovedForAll,
),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
contractWrappers.erc721Token.subscribe(
tokenAddress,
@@ -282,6 +283,7 @@ describe('ERC721Wrapper', () => {
operatorAddress,
tokenId,
),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
})().catch(done);
});
@@ -306,6 +308,7 @@ describe('ERC721Wrapper', () => {
const tokenId = await tokenUtils.mintDummyERC721Async(tokenAddress, ownerAddress);
await web3Wrapper.awaitTransactionSuccessAsync(
await contractWrappers.erc721Token.setApprovalAsync(tokenAddress, approvedAddress, tokenId),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
})().catch(done);
});
@@ -333,6 +336,7 @@ describe('ERC721Wrapper', () => {
const tokenId = await tokenUtils.mintDummyERC721Async(tokenAddress, ownerAddress);
await web3Wrapper.awaitTransactionSuccessAsync(
await contractWrappers.erc721Token.setApprovalAsync(tokenAddress, approvedAddress, tokenId),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
done();
})().catch(done);
@@ -361,6 +365,7 @@ describe('ERC721Wrapper', () => {
operatorAddress,
isApproved,
),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
done();
})().catch(done);
@@ -383,7 +388,7 @@ describe('ERC721Wrapper', () => {
operatorAddress,
true,
);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
const eventName = ERC721TokenEvents.ApprovalForAll;
const indexFilterValues = {};
const logs = await contractWrappers.erc721Token.getLogsAsync<ERC721TokenApprovalForAllEventArgs>(
@@ -406,7 +411,7 @@ describe('ERC721Wrapper', () => {
operatorAddress,
true,
);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
const differentEventName = ERC721TokenEvents.Transfer;
const indexFilterValues = {};
const logs = await contractWrappers.erc721Token.getLogsAsync(
@@ -417,21 +422,21 @@ describe('ERC721Wrapper', () => {
);
expect(logs).to.have.length(0);
});
- it('should only get the logs with the correct indexed fields', async () => {
+ it.only('should only get the logs with the correct indexed fields', async () => {
txHash = await contractWrappers.erc721Token.setApprovalForAllAsync(
tokenAddress,
ownerAddress,
operatorAddress,
true,
);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
txHash = await contractWrappers.erc721Token.setApprovalForAllAsync(
tokenAddress,
anotherOwnerAddress,
operatorAddress,
true,
);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
const eventName = ERC721TokenEvents.ApprovalForAll;
const indexFilterValues = {
_owner: anotherOwnerAddress,
diff --git a/packages/contract-wrappers/test/ether_token_wrapper_test.ts b/packages/contract-wrappers/test/ether_token_wrapper_test.ts
index 1e46f05d1..373d4e935 100644
--- a/packages/contract-wrappers/test/ether_token_wrapper_test.ts
+++ b/packages/contract-wrappers/test/ether_token_wrapper_test.ts
@@ -94,7 +94,7 @@ describe('EtherTokenWrapper', () => {
depositWeiAmount,
addressWithETH,
);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
const postETHBalanceInWei = await web3Wrapper.getBalanceInWeiAsync(addressWithETH);
const postWETHBalanceInBaseUnits = await contractWrappers.erc20Token.getBalanceAsync(
@@ -139,7 +139,7 @@ describe('EtherTokenWrapper', () => {
depositWeiAmount,
addressWithETH,
);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
const postETHBalance = await web3Wrapper.getBalanceInWeiAsync(addressWithETH);
const postWETHBalanceInBaseUnits = await contractWrappers.erc20Token.getBalanceAsync(
@@ -351,7 +351,7 @@ describe('EtherTokenWrapper', () => {
etherTokenAddress,
addressWithETH,
);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
const eventName = WETH9Events.Approval;
const indexFilterValues = {};
const logs = await contractWrappers.etherToken.getLogsAsync<WETH9ApprovalEventArgs>(
@@ -388,7 +388,7 @@ describe('EtherTokenWrapper', () => {
etherTokenAddress,
addressWithETH,
);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
const differentEventName = WETH9Events.Transfer;
const indexFilterValues = {};
const logs = await contractWrappers.etherToken.getLogsAsync(
@@ -404,12 +404,12 @@ describe('EtherTokenWrapper', () => {
etherTokenAddress,
addressWithETH,
);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
txHash = await contractWrappers.erc20Token.setUnlimitedProxyAllowanceAsync(
etherTokenAddress,
addressWithoutFunds,
);
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
const eventName = WETH9Events.Approval;
const indexFilterValues = {
_owner: addressWithETH,
diff --git a/packages/contract-wrappers/test/utils/constants.ts b/packages/contract-wrappers/test/utils/constants.ts
index 62d5a1ade..60c3370a2 100644
--- a/packages/contract-wrappers/test/utils/constants.ts
+++ b/packages/contract-wrappers/test/utils/constants.ts
@@ -5,6 +5,7 @@ export const constants = {
ROPSTEN_NETWORK_ID: 3,
KOVAN_NETWORK_ID: 42,
TESTRPC_NETWORK_ID: 50,
+ AWAIT_TRANSACTION_MINED_MS: 0,
KOVAN_RPC_URL: 'https://kovan.infura.io/',
ROPSTEN_RPC_URL: 'https://ropsten.infura.io/',
ZRX_DECIMALS: 18,