From ba17f98c70065467fbfbad479a593dd61644549f Mon Sep 17 00:00:00 2001 From: barisusakli Date: Sun, 16 Oct 2016 23:48:24 +0300 Subject: [PATCH] getPostSummaryByPids test --- test/posts.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/posts.js b/test/posts.js index 24a2521b99..e1bc67c6f1 100644 --- a/test/posts.js +++ b/test/posts.js @@ -185,6 +185,25 @@ describe('Post\'s', function () { }); }); + describe('getPostSummaryByPids', function () { + it('should return empty array for empty pids', function (done) { + posts.getPostSummaryByPids([], 0, {}, function (err, data) { + assert.ifError(err); + assert.equal(data.length, 0); + done(); + }); + }); + + it('should get post summaries', function (done) { + posts.getPostSummaryByPids([postData.pid], 0, {}, function (err, data) { + assert.ifError(err); + assert(data[0].user); + assert(data[0].topic); + assert(data[0].category); + done(); + }); + }); + }); after(function (done) { db.flushdb(done);