Skip to content

Node.js based forum software built for the modern web

feat: edit test

Barış Soner Uşaklıccddbb15c950
diff --git a/test/posts.js b/test/posts.js
index e4a035bf82..aad50e2684 100644
--- a/test/posts.js
+++ b/test/posts.js
@@ -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) {