diff options
author | Fabio Berger <me@fabioberger.com> | 2018-04-11 18:00:30 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-04-11 18:00:30 +0800 |
commit | 29dc22e208080fa8ff0871b98b530a2deb251a73 (patch) | |
tree | db372a34e85ac8caf4a3f3ed9d7591452df9cb1a /packages/metacoin/test/metacoin_test.ts | |
parent | 6f72fed8b5b37fac5096413b363b533e0a29f7b5 (diff) | |
parent | c44f9e56ada898ffd0d0e57aa228006977fb238c (diff) | |
download | dexon-sol-tools-29dc22e208080fa8ff0871b98b530a2deb251a73.tar dexon-sol-tools-29dc22e208080fa8ff0871b98b530a2deb251a73.tar.gz dexon-sol-tools-29dc22e208080fa8ff0871b98b530a2deb251a73.tar.bz2 dexon-sol-tools-29dc22e208080fa8ff0871b98b530a2deb251a73.tar.lz dexon-sol-tools-29dc22e208080fa8ff0871b98b530a2deb251a73.tar.xz dexon-sol-tools-29dc22e208080fa8ff0871b98b530a2deb251a73.tar.zst dexon-sol-tools-29dc22e208080fa8ff0871b98b530a2deb251a73.zip |
Merge branch 'development' into removeMigrateStep
* development:
Fix lint error
Fix documentation links in some READMEs
Fix relative link
Add step to publishing that upload staging doc jsons, deploys staging website, opens every docs page and asks the dev to confirm that each one renders properly before publishing
Fix web3Wrapper build command
Add top-level `yarn lerna:stage_docs` to upload docJsons to the staging S3 bucket for all packages with a docs page
Added a detailed description of `renameOverloadedMethods` (special thanks to @fabioberger). Updated Javascript styles in the Abi-Gen and Utils packages, around support for function overloading.
Updated deployer to accept a list of contract directories as input. Contract directories are namespaced to a void clashes. Also in this commit is a fix for overloading contract functions.
Refactor publish script to have it's main execution body be lean and discrete steps
# Conflicts:
# packages/contracts/package.json
# packages/deployer/package.json
Diffstat (limited to 'packages/metacoin/test/metacoin_test.ts')
-rw-r--r-- | packages/metacoin/test/metacoin_test.ts | 56 |
1 files changed, 54 insertions, 2 deletions
diff --git a/packages/metacoin/test/metacoin_test.ts b/packages/metacoin/test/metacoin_test.ts index 73537d342..51830d1ef 100644 --- a/packages/metacoin/test/metacoin_test.ts +++ b/packages/metacoin/test/metacoin_test.ts @@ -36,12 +36,12 @@ describe('Metacoin', () => { }); }); describe('#transfer', () => { - it(`should successfully transfer tokens`, async () => { + it(`should successfully transfer tokens (via transfer1)`, async () => { const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'; const amount = INITIAL_BALANCE.div(2); const oldBalance = await metacoin.balances.callAsync(ZERO_ADDRESS); expect(oldBalance).to.be.bignumber.equal(0); - const txHash = await metacoin.transfer.sendTransactionAsync( + const txHash = await metacoin.transfer1.sendTransactionAsync( { to: ZERO_ADDRESS, amount, @@ -58,5 +58,57 @@ describe('Metacoin', () => { const newBalance = await metacoin.balances.callAsync(ZERO_ADDRESS); expect(newBalance).to.be.bignumber.equal(amount); }); + + it(`should successfully transfer tokens (via transfer2)`, async () => { + const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'; + const amount = INITIAL_BALANCE.div(2); + const oldBalance = await metacoin.balances.callAsync(ZERO_ADDRESS); + expect(oldBalance).to.be.bignumber.equal(0); + const callback = 59; + const txHash = await metacoin.transfer2.sendTransactionAsync( + { + to: ZERO_ADDRESS, + amount, + }, + callback, + { from: devConstants.TESTRPC_FIRST_ADDRESS }, + ); + const txReceipt = await web3Wrapper.awaitTransactionMinedAsync(txHash); + const transferLogs = txReceipt.logs[0] as LogWithDecodedArgs<TransferContractEventArgs>; + expect(transferLogs.args).to.be.deep.equal({ + _to: ZERO_ADDRESS, + _from: devConstants.TESTRPC_FIRST_ADDRESS, + _value: amount, + }); + const newBalance = await metacoin.balances.callAsync(ZERO_ADDRESS); + expect(newBalance).to.be.bignumber.equal(amount); + }); + + it(`should successfully transfer tokens (via transfer3)`, async () => { + const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'; + const amount = INITIAL_BALANCE.div(2); + const oldBalance = await metacoin.balances.callAsync(ZERO_ADDRESS); + expect(oldBalance).to.be.bignumber.equal(0); + const callback = 59; + const txHash = await metacoin.transfer3.sendTransactionAsync( + { + transferData: { + to: ZERO_ADDRESS, + amount, + }, + callback, + }, + { from: devConstants.TESTRPC_FIRST_ADDRESS }, + ); + const txReceipt = await web3Wrapper.awaitTransactionMinedAsync(txHash); + const transferLogs = txReceipt.logs[0] as LogWithDecodedArgs<TransferContractEventArgs>; + expect(transferLogs.args).to.be.deep.equal({ + _to: ZERO_ADDRESS, + _from: devConstants.TESTRPC_FIRST_ADDRESS, + _value: amount, + }); + const newBalance = await metacoin.balances.callAsync(ZERO_ADDRESS); + expect(newBalance).to.be.bignumber.equal(amount); + }); }); }); |