Last active
August 6, 2021 11:29
-
-
Save percybolmer/984d2e6773f339ef119b038fea9bc427 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
// Stake again on owner because we want hasStake test to assert summary | |
stakeID = await devToken.stake(stake_amount, { from: owner }); | |
// 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, 1, "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