Skip to content

Instantly share code, notes, and snippets.

@mager
Last active Feb 2, 2018
Embed
What would you like to do?
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