Skip to content

Instantly share code, notes, and snippets.

@mager
Last active February 2, 2018 13:36
Show Gist options
  • Save mager/f49f5690a5fed631922309c4e54637c5 to your computer and use it in GitHub Desktop.
Save mager/f49f5690a5fed631922309c4e54637c5 to your computer and use it in GitHub Desktop.
Testing a lottery contract (snippet)
it('allows an account to enter', async () => {
await lottery.methods.enter().send({
from: accounts[0],
value: web3.utils.toWei('0.015', 'ether'),
});
const players = await lottery.methods.players().call({
from: accounts[0],
});
const balance = await lottery.methods.getBalance().call({
from: accounts[0],
})
assert.equal(accounts[0], players[0]);
assert.equal(players.length, 1);
assert.equal(balance, web3.utils.toWei('0.015', 'ether'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment