2

How is it possible to test if my contract actually transfers money to a specific account?

function _transfer(address receiver_, uint256 payout) internal{
    receiver_.transfer(payout);
}

Testing in JavaScript Syntax. Expecting something like:

assert.equal(accounts[1].balance, 100 Ether);
4

To assert the balance of an account, try this:

let expectedBalance = web3.toBigNumber(web3.toWei(3, 'ether'));
let actualBalance = web3.eth.getBalance(accounts[1]);

assert.deepEqual(actualBalance, expectedBalance, "Balance incorrect!");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.