diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2018-04-04 08:39:55 +0800 |
---|---|---|
committer | Greg Hysen <greg.hysen@gmail.com> | 2018-04-10 08:22:58 +0800 |
commit | 61fc3346c2fe2adc33dfe84aa50780d61e10efdf (patch) | |
tree | 1f5ab2cddf7093db8f8fb419ef70da66a9997c7b /packages/metacoin/test | |
parent | 073bf738ddb271b6b4158798baf4cac3cb0608e9 (diff) | |
download | dexon-sol-tools-61fc3346c2fe2adc33dfe84aa50780d61e10efdf.tar dexon-sol-tools-61fc3346c2fe2adc33dfe84aa50780d61e10efdf.tar.gz dexon-sol-tools-61fc3346c2fe2adc33dfe84aa50780d61e10efdf.tar.bz2 dexon-sol-tools-61fc3346c2fe2adc33dfe84aa50780d61e10efdf.tar.lz dexon-sol-tools-61fc3346c2fe2adc33dfe84aa50780d61e10efdf.tar.xz dexon-sol-tools-61fc3346c2fe2adc33dfe84aa50780d61e10efdf.tar.zst dexon-sol-tools-61fc3346c2fe2adc33dfe84aa50780d61e10efdf.zip |
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.
Diffstat (limited to 'packages/metacoin/test')
-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..4a2307444 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 transfer_1)`, 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.transfer_1.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 transfer_2)`, 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.transfer_2.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 transfer_3)`, 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.transfer_3.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); + }); }); }); |