mirror of
https://github.com/embarklabs/dreddit-tutorial.git
synced 2025-02-20 04:28:07 +00:00
step 8: test correctness of data
This commit is contained in:
parent
bf3838677c
commit
0915ce8ede
@ -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]);
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user