Last active
February 2, 2018 13:36
-
-
Save mager/f49f5690a5fed631922309c4e54637c5 to your computer and use it in GitHub Desktop.
Testing a lottery contract (snippet)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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