aboutsummaryrefslogtreecommitdiffstats
path: root/packages/metacoin/test/metacoin_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/metacoin/test/metacoin_test.ts')
-rw-r--r--packages/metacoin/test/metacoin_test.ts56
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);
+ });
});
});