mirror of
https://github.com/embarklabs/dreddit-tutorial.git
synced 2026-08-30 21:11:08 +00:00
step 10: test vote()
This commit is contained in:
@@ -40,4 +40,10 @@ contract('DReddit', () => {
|
||||
const userCanVote = await DReddit.methods.canVote(postId).call();
|
||||
assert.equal(userCanVote, true);
|
||||
});
|
||||
|
||||
it('should be able to vote in a post', async () => {
|
||||
const receipt = await DReddit.methods.vote(postId, 1).send();
|
||||
const Vote = receipt.events.NewVote;
|
||||
assert.equal(Vote.returnValues.owner, accounts[0]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user