From 4684ab3bf6dcc743b5f8c150de501331e2f4bc69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 14 Jun 2018 17:55:19 -0400 Subject: [PATCH] suggest topic test --- test/topics.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/test/topics.js b/test/topics.js index e98a03a270..4dec7a37c4 100644 --- a/test/topics.js +++ b/test/topics.js @@ -979,7 +979,7 @@ describe('Topic\'s', function () { describe('suggested topics', function () { var tid1; - var tid2; + var tid3; before(function (done) { async.parallel({ topic1: function (next) { @@ -988,10 +988,13 @@ describe('Topic\'s', function () { topic2: function (next) { topics.post({ uid: adminUid, tags: ['nodebb'], title: 'topic title 2', content: 'topic 2 content', cid: topic.categoryId }, next); }, + topic3: function (next) { + topics.post({ uid: adminUid, tags: [], title: 'topic title 3', content: 'topic 3 content', cid: topic.categoryId }, next); + }, }, function (err, results) { assert.ifError(err); tid1 = results.topic1.topicData.tid; - tid2 = results.topic2.topicData.tid; + tid3 = results.topic3.topicData.tid; done(); }); }); @@ -1003,6 +1006,14 @@ describe('Topic\'s', function () { done(); }); }); + + it('should return suggested topics', function (done) { + topics.getSuggestedTopics(tid3, adminUid, 0, 2, function (err, topics) { + assert.ifError(err); + assert(Array.isArray(topics)); + done(); + }); + }); }); describe('unread', function () {