From 6ca11b2ada6756cc1841be367cba718cf54947d1 Mon Sep 17 00:00:00 2001 From: Pascal Precht Date: Tue, 29 Jan 2019 13:06:00 +0100 Subject: [PATCH] step 10: test vote() --- test/DReddit_spec.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/DReddit_spec.js b/test/DReddit_spec.js index 9f339e3..e46ada7 100644 --- a/test/DReddit_spec.js +++ b/test/DReddit_spec.js @@ -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]); + }); });