Skip to content

Commit

Permalink
feat: edit test
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Sep 21, 2020
1 parent e72fe25 commit ccddbb1
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions test/posts.js
Expand Up @@ -554,15 +554,20 @@ describe('Post\'s', function () {
});
});

it('should edit post', function (done) {
socketPosts.edit({ uid: voterUid }, { pid: pid, content: 'edited post content', title: 'edited title', tags: ['edited'] }, function (err, data) {
assert.ifError(err);
assert.equal(data.content, 'edited post content');
assert.equal(data.editor, voterUid);
assert.equal(data.topic.title, 'edited title');
assert.equal(data.topic.tags[0].value, 'edited');
done();
});
it('should edit post', async function () {
const data = await socketPosts.edit({ uid: voterUid }, {
pid: pid,
content: 'edited post content',
title: 'edited title',
tags: ['edited'],
});

assert.strictEqual(data.content, 'edited post content');
assert.strictEqual(data.editor, voterUid);
assert.strictEqual(data.topic.title, 'edited title');
assert.strictEqual(data.topic.tags[0].value, 'edited');
const res = await db.getObject('post:' + pid);
assert(!res.hasOwnProperty('bookmarks'));
});

it('should disallow post editing for new users if post was made past the threshold for editing', function (done) {
Expand Down

0 comments on commit ccddbb1

Please sign in to comment.