diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-08-24 21:26:59 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-08-25 04:48:51 +0800 |
commit | 6f227c152d49b6266fab3c8eb054c16e3c9cef45 (patch) | |
tree | 5d8b89a0c45bdaef6d5b28a4383eeb1700575245 /test/token_wrapper_test.ts | |
parent | af242278c35eba00ad48fdb7699800ac28f54059 (diff) | |
download | dexon-0x-contracts-6f227c152d49b6266fab3c8eb054c16e3c9cef45.tar dexon-0x-contracts-6f227c152d49b6266fab3c8eb054c16e3c9cef45.tar.gz dexon-0x-contracts-6f227c152d49b6266fab3c8eb054c16e3c9cef45.tar.bz2 dexon-0x-contracts-6f227c152d49b6266fab3c8eb054c16e3c9cef45.tar.lz dexon-0x-contracts-6f227c152d49b6266fab3c8eb054c16e3c9cef45.tar.xz dexon-0x-contracts-6f227c152d49b6266fab3c8eb054c16e3c9cef45.tar.zst dexon-0x-contracts-6f227c152d49b6266fab3c8eb054c16e3c9cef45.zip |
Add tests for unlimited allowance
Diffstat (limited to 'test/token_wrapper_test.ts')
-rw-r--r-- | test/token_wrapper_test.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/token_wrapper_test.ts b/test/token_wrapper_test.ts index 8adaa6351..e466cc0ad 100644 --- a/test/token_wrapper_test.ts +++ b/test/token_wrapper_test.ts @@ -206,6 +206,17 @@ describe('TokenWrapper', () => { return expect(allowanceAfterSet).to.be.bignumber.equal(expectedAllowanceAfterAllowanceSet); }); }); + describe('#setUnlimitedAllowanceAsync', () => { + it('should set the unlimited spender\'s allowance', async () => { + const token = tokens[0]; + const ownerAddress = coinbase; + const spenderAddress = addressWithoutFunds; + + await zeroEx.token.setUnlimitedAllowanceAsync(token.address, ownerAddress, spenderAddress); + const allowance = await zeroEx.token.getAllowanceAsync(token.address, ownerAddress, spenderAddress); + return expect(allowance).to.be.bignumber.equal(zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS); + }); + }); describe('#getAllowanceAsync', () => { describe('With web3 provider with accounts', () => { it('should get the proxy allowance', async () => { @@ -282,6 +293,16 @@ describe('TokenWrapper', () => { return expect(allowanceAfterSet).to.be.bignumber.equal(expectedAllowanceAfterAllowanceSet); }); }); + describe('#setUnlimitedProxyAllowanceAsync', () => { + it('should set the unlimited proxy allowance', async () => { + const token = tokens[0]; + const ownerAddress = coinbase; + + await zeroEx.token.setUnlimitedProxyAllowanceAsync(token.address, ownerAddress); + const allowance = await zeroEx.token.getProxyAllowanceAsync(token.address, ownerAddress); + return expect(allowance).to.be.bignumber.equal(zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS); + }); + }); describe('#subscribeAsync', () => { const indexFilterValues = {}; const shouldThrowOnInsufficientBalanceOrAllowance = true; |