From f8f0a83b52a66cba8b3e75e61e3cfbd2b5e04cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 6 Dec 2021 17:18:38 -0500 Subject: [PATCH] test: one more getTopicPosts test --- test/topics.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/topics.js b/test/topics.js index 48b9469365..5a2db3ce15 100644 --- a/test/topics.js +++ b/test/topics.js @@ -543,6 +543,16 @@ describe('Topic\'s', () => { assert.strictEqual(data.posts[0].content, 'topic reply 5'); assert.strictEqual(data.posts[1].content, 'topic reply 6'); }); + + it('should return all posts in correct order', async () => { + const topicData = await topics.getTopicData(tid); + const postsData = await topics.getTopicPosts(topicData, `tid:${tid}:posts`, 0, -1, topic.userId, false); + assert.strictEqual(postsData.length, 31); + assert.strictEqual(postsData[0].content, 'main post'); + for (let i = 1; i < 30; i++) { + assert.strictEqual(postsData[i].content, `topic reply ${i}`); + } + }); }); });