diff options
author | Leonid <logvinov.leon@gmail.com> | 2018-02-07 18:40:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-07 18:40:06 +0800 |
commit | 12d62e1157168ec9e8cd23749523b2bcda8eefe5 (patch) | |
tree | 7061d10b3958647e51644593cd7e0be890048576 /packages/contracts/test/zrx_token.ts | |
parent | 4c9c4c487a034d926443eeb8a0154fd38c97aca3 (diff) | |
parent | 0bad911a16dd2924e5be693710a422383aba4871 (diff) | |
download | dexon-sol-tools-12d62e1157168ec9e8cd23749523b2bcda8eefe5.tar dexon-sol-tools-12d62e1157168ec9e8cd23749523b2bcda8eefe5.tar.gz dexon-sol-tools-12d62e1157168ec9e8cd23749523b2bcda8eefe5.tar.bz2 dexon-sol-tools-12d62e1157168ec9e8cd23749523b2bcda8eefe5.tar.lz dexon-sol-tools-12d62e1157168ec9e8cd23749523b2bcda8eefe5.tar.xz dexon-sol-tools-12d62e1157168ec9e8cd23749523b2bcda8eefe5.tar.zst dexon-sol-tools-12d62e1157168ec9e8cd23749523b2bcda8eefe5.zip |
Merge pull request #368 from 0xProject/feature/abigen/addNetworkId
Add CLI option for networkId, add abi-gen to contracts package
Diffstat (limited to 'packages/contracts/test/zrx_token.ts')
-rw-r--r-- | packages/contracts/test/zrx_token.ts | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/packages/contracts/test/zrx_token.ts b/packages/contracts/test/zrx_token.ts index 1844a67af..1610ada12 100644 --- a/packages/contracts/test/zrx_token.ts +++ b/packages/contracts/test/zrx_token.ts @@ -5,6 +5,7 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; import * as Web3 from 'web3'; +import { ZRXTokenContract } from '../src/contract_wrappers/generated/zrx_token'; import { constants } from '../util/constants'; import { ContractName } from '../util/types'; @@ -24,7 +25,7 @@ describe('ZRXToken', () => { let MAX_UINT: BigNumber; - let zrx: Web3.ContractInstance; + let zrx: ZRXTokenContract; let zrxAddress: string; before(async () => { @@ -34,7 +35,8 @@ describe('ZRXToken', () => { zeroEx = new ZeroEx(web3.currentProvider, { networkId: constants.TESTRPC_NETWORK_ID, }); - zrx = await deployer.deployAsync(ContractName.ZRXToken); + const zrxInstance = await deployer.deployAsync(ContractName.ZRXToken); + zrx = new ZRXTokenContract(zrxInstance); zrxAddress = zrx.address; MAX_UINT = zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS; }); @@ -94,7 +96,7 @@ describe('ZRXToken', () => { }); it('should return true on a 0 value transfer', async () => { - const didReturnTrue = await zrx.transfer.call(spender, 0, { + const didReturnTrue = await zrx.transfer.callAsync(spender, new BigNumber(0), { from: owner, }); expect(didReturnTrue).to.be.true(); @@ -108,7 +110,7 @@ describe('ZRXToken', () => { await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, amountToTransfer, { gasLimit: constants.MAX_TOKEN_APPROVE_GAS, }); - const didReturnTrue = await zrx.transferFrom.call(owner, spender, amountToTransfer, { from: spender }); + const didReturnTrue = await zrx.transferFrom.callAsync(owner, spender, amountToTransfer, { from: spender }); expect(didReturnTrue).to.be.false(); }); @@ -120,13 +122,13 @@ describe('ZRXToken', () => { const spenderAllowanceIsInsufficient = spenderAllowance.cmp(amountToTransfer) < 0; expect(spenderAllowanceIsInsufficient).to.be.true(); - const didReturnTrue = await zrx.transferFrom.call(owner, spender, amountToTransfer, { from: spender }); + const didReturnTrue = await zrx.transferFrom.callAsync(owner, spender, amountToTransfer, { from: spender }); expect(didReturnTrue).to.be.false(); }); it('should return true on a 0 value transfer', async () => { - const amountToTransfer = 0; - const didReturnTrue = await zrx.transferFrom.call(owner, spender, amountToTransfer, { from: spender }); + const amountToTransfer = new BigNumber(0); + const didReturnTrue = await zrx.transferFrom.callAsync(owner, spender, amountToTransfer, { from: spender }); expect(didReturnTrue).to.be.true(); }); |