diff options
-rw-r--r-- | test/token_wrapper_test.ts | 10 |
1 files changed, 10 insertions, 0 deletions
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); |