From 31c98fc0db21300cb32e265c49b3f0320c315f01 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Tue, 29 May 2018 17:54:08 -0700 Subject: Update some tests after rebase --- packages/contracts/test/ether_token.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'packages/contracts/test/ether_token.ts') diff --git a/packages/contracts/test/ether_token.ts b/packages/contracts/test/ether_token.ts index 4e52b658f..f63d143a6 100644 --- a/packages/contracts/test/ether_token.ts +++ b/packages/contracts/test/ether_token.ts @@ -41,7 +41,8 @@ describe('EtherToken', () => { await blockchainLifecycle.revertAsync(); }); describe('deposit', () => { - it('should throw if caller attempts to deposit more Ether than caller balance', async () => { + // TODO(albrow): AssertionError: expected promise to be rejected with an error including 'ender doesn\'t have enough funds to send tx.' but got 'insufficient funds for gas * price + value' + it.skip('should throw if caller attempts to deposit more Ether than caller balance', async () => { const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account); const ethToDeposit = initEthBalance.plus(1); @@ -72,7 +73,8 @@ describe('EtherToken', () => { }); describe('withdraw', () => { - it('should throw if caller attempts to withdraw greater than caller balance', async () => { + // TODO(albrow): AssertionError: expected promise to be rejected with an error including 'revert' but got 'gas required exceeds allowance or always failing transaction' + it.skip('should throw if caller attempts to withdraw greater than caller balance', async () => { const initEthTokenBalance = await etherToken.balanceOf.callAsync(account); const ethTokensToWithdraw = initEthTokenBalance.plus(1); -- cgit v1.2.3 From 2dfc4680941293ca9f4a55f3ca58b9ee68872754 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Fri, 1 Jun 2018 15:59:34 -0700 Subject: Update more tests to pass on Geth --- packages/contracts/test/ether_token.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'packages/contracts/test/ether_token.ts') diff --git a/packages/contracts/test/ether_token.ts b/packages/contracts/test/ether_token.ts index f63d143a6..ee1a0a876 100644 --- a/packages/contracts/test/ether_token.ts +++ b/packages/contracts/test/ether_token.ts @@ -6,6 +6,7 @@ import 'make-promises-safe'; import { WETH9Contract } from '../src/contract_wrappers/generated/weth9'; import { artifacts } from '../src/utils/artifacts'; +import { expectInsufficientFunds, expectRevertOrAlwaysFailingTransaction } from '../src/utils/assertions'; import { chaiSetup } from '../src/utils/chai_setup'; import { constants } from '../src/utils/constants'; import { provider, txDefaults, web3Wrapper } from '../src/utils/web3_wrapper'; @@ -41,14 +42,11 @@ describe('EtherToken', () => { await blockchainLifecycle.revertAsync(); }); describe('deposit', () => { - // TODO(albrow): AssertionError: expected promise to be rejected with an error including 'ender doesn\'t have enough funds to send tx.' but got 'insufficient funds for gas * price + value' - it.skip('should throw if caller attempts to deposit more Ether than caller balance', async () => { + it('should throw if caller attempts to deposit more Ether than caller balance', async () => { const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account); const ethToDeposit = initEthBalance.plus(1); - return expect(etherToken.deposit.sendTransactionAsync({ value: ethToDeposit })).to.be.rejectedWith( - "ender doesn't have enough funds to send tx.", - ); + return expectInsufficientFunds(etherToken.deposit.sendTransactionAsync({ value: ethToDeposit })); }); it('should convert deposited Ether to wrapped Ether tokens', async () => { @@ -73,13 +71,12 @@ describe('EtherToken', () => { }); describe('withdraw', () => { - // TODO(albrow): AssertionError: expected promise to be rejected with an error including 'revert' but got 'gas required exceeds allowance or always failing transaction' - it.skip('should throw if caller attempts to withdraw greater than caller balance', async () => { + it('should throw if caller attempts to withdraw greater than caller balance', async () => { const initEthTokenBalance = await etherToken.balanceOf.callAsync(account); const ethTokensToWithdraw = initEthTokenBalance.plus(1); - return expect(etherToken.withdraw.sendTransactionAsync(ethTokensToWithdraw)).to.be.rejectedWith( - constants.REVERT, + return expectRevertOrAlwaysFailingTransaction( + etherToken.withdraw.sendTransactionAsync(ethTokensToWithdraw), ); }); -- cgit v1.2.3 From 167a38e27d09af12af6c59f1b486c835420fbac1 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Tue, 5 Jun 2018 16:56:16 -0700 Subject: Add Async suffix to relevant assertions --- packages/contracts/test/ether_token.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'packages/contracts/test/ether_token.ts') diff --git a/packages/contracts/test/ether_token.ts b/packages/contracts/test/ether_token.ts index ee1a0a876..e9331b16e 100644 --- a/packages/contracts/test/ether_token.ts +++ b/packages/contracts/test/ether_token.ts @@ -6,7 +6,7 @@ import 'make-promises-safe'; import { WETH9Contract } from '../src/contract_wrappers/generated/weth9'; import { artifacts } from '../src/utils/artifacts'; -import { expectInsufficientFunds, expectRevertOrAlwaysFailingTransaction } from '../src/utils/assertions'; +import { expectInsufficientFundsAsync, expectRevertOrAlwaysFailingTransactionAsync } from '../src/utils/assertions'; import { chaiSetup } from '../src/utils/chai_setup'; import { constants } from '../src/utils/constants'; import { provider, txDefaults, web3Wrapper } from '../src/utils/web3_wrapper'; @@ -46,7 +46,7 @@ describe('EtherToken', () => { const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account); const ethToDeposit = initEthBalance.plus(1); - return expectInsufficientFunds(etherToken.deposit.sendTransactionAsync({ value: ethToDeposit })); + return expectInsufficientFundsAsync(etherToken.deposit.sendTransactionAsync({ value: ethToDeposit })); }); it('should convert deposited Ether to wrapped Ether tokens', async () => { @@ -75,7 +75,7 @@ describe('EtherToken', () => { const initEthTokenBalance = await etherToken.balanceOf.callAsync(account); const ethTokensToWithdraw = initEthTokenBalance.plus(1); - return expectRevertOrAlwaysFailingTransaction( + return expectRevertOrAlwaysFailingTransactionAsync( etherToken.withdraw.sendTransactionAsync(ethTokensToWithdraw), ); }); -- cgit v1.2.3