step 8: test correctness of data

This commit is contained in:
Pascal Precht 2019-01-29 12:31:12 +01:00
parent bf3838677c
commit 0915ce8ede
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D

View File

@ -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]);
});
});