From 38cf621327443dab988721881b27ed10f6efe331 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 5 Jun 2017 13:13:04 +0200 Subject: Add regression test for transferFrom bug --- test/token_wrapper_test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/token_wrapper_test.ts b/test/token_wrapper_test.ts index 698ad5b6a..3cfc6d197 100644 --- a/test/token_wrapper_test.ts +++ b/test/token_wrapper_test.ts @@ -89,6 +89,16 @@ describe('TokenWrapper', () => { token.address, fromAddress, toAddress, senderAddress, transferAmount, )).to.be.rejectedWith(ZeroExError.INSUFFICIENT_ALLOWANCE_FOR_TRANSFER); }); + it('should fail to transfer tokens if set allowance for toAddress instead of senderAddress', async () => { + const fromAddress = coinbase; + const transferAmount = new BigNumber(42); + + await zeroEx.token.setAllowanceAsync(token.address, fromAddress, toAddress, transferAmount); + + return expect(zeroEx.token.transferFromAsync( + token.address, fromAddress, toAddress, senderAddress, transferAmount, + )).to.be.rejectedWith(ZeroExError.INSUFFICIENT_ALLOWANCE_FOR_TRANSFER); + }); it('should fail to transfer tokens if fromAddress has insufficient balance', async () => { const fromAddress = addressWithoutFunds; const transferAmount = new BigNumber(42); -- cgit v1.2.3