Last active
August 6, 2021 11:28
-
-
Save percybolmer/dbee8e94772f225a80d6e8fb6719570a to your computer and use it in GitHub Desktop.
This file contains hidden or 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("new stakeholder should have increased index", async () => { | |
let stake_amount = 100; | |
stakeID = await devToken.stake(stake_amount, { from: accounts[1] }); | |
// Assert on the emittedevent using truffleassert | |
// This will capture the event and inside the event callback we can use assert on the values returned | |
truffleAssert.eventEmitted( | |
stakeID, | |
"Staked", | |
(ev) => { | |
// In here we can do our assertion on the ev variable (its the event and will contain the values we emitted) | |
assert.equal(ev.amount, stake_amount, "Stake amount in event was not correct"); | |
assert.equal(ev.index, 2, "Stake index was not correct"); | |
return true; | |
}, | |
"Stake event should have triggered"); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment