step 10: test vote()

This commit is contained in:
Pascal Precht 2019-01-29 13:06:00 +01:00
parent e0d53e26cb
commit 6ca11b2ada
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 6 additions and 0 deletions

View File

@ -40,4 +40,10 @@ contract('DReddit', () => {
const userCanVote = await DReddit.methods.canVote(postId).call(); const userCanVote = await DReddit.methods.canVote(postId).call();
assert.equal(userCanVote, true); 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]);
});
}); });