diff options
author | Fabio Berger <me@fabioberger.com> | 2018-01-19 23:13:31 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-02-03 01:39:08 +0800 |
commit | 2721252d6a82e83801c650ebad6a2cb4d7195bc1 (patch) | |
tree | c22be8b830f57e8984be92d6936f5fefc9c44c2d /packages/contracts/test/unlimited_allowance_token.ts | |
parent | 47d74aa24ac06de33ae331f3589e9c8013c655ec (diff) | |
download | dexon-0x-contracts-2721252d6a82e83801c650ebad6a2cb4d7195bc1.tar.gz dexon-0x-contracts-2721252d6a82e83801c650ebad6a2cb4d7195bc1.tar.zst dexon-0x-contracts-2721252d6a82e83801c650ebad6a2cb4d7195bc1.zip |
Get rid of suffixed contract versioning and replace it with a poor-mans package manager. Versions are stored locally, and are generated in a copy-on-write basis as required
Diffstat (limited to 'packages/contracts/test/unlimited_allowance_token.ts')
-rw-r--r-- | packages/contracts/test/unlimited_allowance_token.ts | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/packages/contracts/test/unlimited_allowance_token.ts b/packages/contracts/test/unlimited_allowance_token.ts index 7f4fef987..34d2ba33b 100644 --- a/packages/contracts/test/unlimited_allowance_token.ts +++ b/packages/contracts/test/unlimited_allowance_token.ts @@ -44,6 +44,14 @@ describe('UnlimitedAllowanceToken', () => { await blockchainLifecycle.revertAsync(); }); describe('transfer', () => { + it('should throw if owner has insufficient balance', async () => { + const ownerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner); + const amountToTransfer = ownerBalance.plus(1); + return expect(token.transfer.call(spender, amountToTransfer, { from: owner })).to.be.rejectedWith( + constants.REVERT, + ); + }); + it('should transfer balance from sender to receiver', async () => { const receiver = spender; const initOwnerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner); @@ -67,15 +75,18 @@ describe('UnlimitedAllowanceToken', () => { }); describe('transferFrom', () => { - it('should return false if owner has insufficient balance', async () => { + it('should throw if owner has insufficient balance', async () => { const ownerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner); const amountToTransfer = ownerBalance.plus(1); await zeroEx.token.setAllowanceAsync(tokenAddress, owner, spender, amountToTransfer); - const didReturnTrue = await token.transferFrom.call(owner, spender, amountToTransfer, { from: spender }); - expect(didReturnTrue).to.be.false(); + return expect( + token.transferFrom.call(owner, spender, amountToTransfer, { + from: spender, + }), + ).to.be.rejectedWith(constants.REVERT); }); - it('should return false if spender has insufficient allowance', async () => { + it('should throw if spender has insufficient allowance', async () => { const ownerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner); const amountToTransfer = ownerBalance; @@ -83,8 +94,11 @@ describe('UnlimitedAllowanceToken', () => { const spenderAllowanceIsInsufficient = spenderAllowance.cmp(amountToTransfer) < 0; expect(spenderAllowanceIsInsufficient).to.be.true(); - const didReturnTrue = await token.transferFrom.call(owner, spender, amountToTransfer, { from: spender }); - expect(didReturnTrue).to.be.false(); + return expect( + token.transferFrom.call(owner, spender, amountToTransfer, { + from: spender, + }), + ).to.be.rejectedWith(constants.REVERT); }); it('should return true on a 0 value transfer', async () => { |