diff --git a/test/DReddit_spec.js b/test/DReddit_spec.js index a03db19..76a7570 100644 --- a/test/DReddit_spec.js +++ b/test/DReddit_spec.js @@ -1,12 +1,16 @@ const DReddit = embark.require('Embark/contracts/DReddit'); const ipfsHash = 'Qmc5gCcjYypU7y28oCALwfSvxCBskLuPKWpK4qpterKC7z'; +let accounts = []; config({ contracts: { DReddit: {} } -}) +}, (err, _accounts) => { + accounts = _accounts; +}); + contract('DReddit', () => { @@ -20,4 +24,10 @@ contract('DReddit', () => { postId = event.returnValues.postId; assert.equal(web3.utils.toAscii(event.returnValues.description), ipfsHash); }); + + it ('post should have correct data', async () => { + const post = await DReddit.methods.posts(postId).call(); + assert.equal(web3.utils.toAscii(post.description), ipfsHash); + assert.equal(post.owner, accounts[0]); + }); });