diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-02-08 02:27:22 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-02-08 02:27:22 +0800 |
commit | f3c6cce4559d096a2f3babfc7af670d078a6f0dd (patch) | |
tree | 580c59d474d52affc57593d25eb1d0acd480d4b0 /packages/contracts/test/zrx_token.ts | |
parent | d9b1d31e7310f7f554f1740f93e4ccd5b5db90f5 (diff) | |
parent | a26e77074fdf5ea7a754a7a676ebd752668d3c82 (diff) | |
download | dexon-0x-contracts-f3c6cce4559d096a2f3babfc7af670d078a6f0dd.tar.gz dexon-0x-contracts-f3c6cce4559d096a2f3babfc7af670d078a6f0dd.tar.zst dexon-0x-contracts-f3c6cce4559d096a2f3babfc7af670d078a6f0dd.zip |
Merge branch 'development' into feature/testnet-faucets/queue-by-network
* development: (24 commits)
Fix Remco's github name in CODEOWNERS
Fix ABI error message
Stop using definite assignment assertion cause prettier doesn't handle that
Special-case ZRXToken snake case conversion
Fix linter errors
Generate contract wrappers on pre-build
Add missing async
Remove noImplicitThis
Tslint disable no-consecutive-blank-lines in generated files
Change compiled sources in contracts
Change utils
Change tests
Add base_contract.ts
Remove generated files
.gitignore gemerated files
Change the list of generated wrappers
Change contract templates
Add indices for index parameters so that their names don't collide
Use abi-gen for events in 0x.js
Fix artifacts path
...
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(); }); |