aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/unlimited_allowance_token.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/test/unlimited_allowance_token.ts')
-rw-r--r--packages/contracts/test/unlimited_allowance_token.ts58
1 files changed, 41 insertions, 17 deletions
diff --git a/packages/contracts/test/unlimited_allowance_token.ts b/packages/contracts/test/unlimited_allowance_token.ts
index c68d8bdcf..b2acdebaa 100644
--- a/packages/contracts/test/unlimited_allowance_token.ts
+++ b/packages/contracts/test/unlimited_allowance_token.ts
@@ -64,7 +64,10 @@ describe('UnlimitedAllowanceToken', () => {
const receiver = spender;
const initOwnerBalance = await token.balanceOf.callAsync(owner);
const amountToTransfer = new BigNumber(1);
- await token.transfer.sendTransactionAsync(receiver, amountToTransfer, { from: owner });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.transfer.sendTransactionAsync(receiver, amountToTransfer, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
const finalOwnerBalance = await token.balanceOf.callAsync(owner);
const finalReceiverBalance = await token.balanceOf.callAsync(receiver);
@@ -86,7 +89,10 @@ describe('UnlimitedAllowanceToken', () => {
it('should throw if owner has insufficient balance', async () => {
const ownerBalance = await token.balanceOf.callAsync(owner);
const amountToTransfer = ownerBalance.plus(1);
- await token.approve.sendTransactionAsync(spender, amountToTransfer, { from: owner });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.approve.sendTransactionAsync(spender, amountToTransfer, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
return expect(
token.transferFrom.callAsync(owner, spender, amountToTransfer, {
from: spender,
@@ -121,11 +127,17 @@ describe('UnlimitedAllowanceToken', () => {
const initOwnerBalance = await token.balanceOf.callAsync(owner);
const amountToTransfer = initOwnerBalance;
const initSpenderAllowance = constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
- await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner });
- await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
- from: spender,
- gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
- });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
const newSpenderAllowance = await token.allowance.callAsync(owner, spender);
expect(initSpenderAllowance).to.be.bignumber.equal(newSpenderAllowance);
@@ -135,11 +147,17 @@ describe('UnlimitedAllowanceToken', () => {
const initOwnerBalance = await token.balanceOf.callAsync(owner);
const amountToTransfer = initOwnerBalance;
const initSpenderAllowance = initOwnerBalance;
- await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner });
- await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
- from: spender,
- gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
- });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
const newOwnerBalance = await token.balanceOf.callAsync(owner);
const newSpenderBalance = await token.balanceOf.callAsync(spender);
@@ -152,11 +170,17 @@ describe('UnlimitedAllowanceToken', () => {
const initOwnerBalance = await token.balanceOf.callAsync(owner);
const amountToTransfer = initOwnerBalance;
const initSpenderAllowance = initOwnerBalance;
- await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner });
- await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
- from: spender,
- gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
- });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
const newSpenderAllowance = await token.allowance.callAsync(owner, spender);
expect(newSpenderAllowance).to.be.bignumber.equal(0);