From a867b77509fa1cc55bac425f56798ff5761a3baa Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Fri, 12 Oct 2018 12:58:11 -0400 Subject: [PATCH] add assert message to test --- test/topics.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/test/topics.js b/test/topics.js index 1a8c7bcfc2..f8e4e95087 100644 --- a/test/topics.js +++ b/test/topics.js @@ -432,17 +432,25 @@ describe('Topic\'s', function () { 'cid:' + cid2 + ':tids:posts', ], tid2, next); }, + posts1: function (next) { + db.getSortedSetRangeWithScores('tid:' + tid1 + ':posts', 0, -1, next); + }, + posts2: function (next) { + db.getSortedSetRangeWithScores('tid:' + tid2 + ':posts', 0, -1, next); + }, }, next); }, function (results, next) { - assert.equal(results.topicData[0].lastposttime, results.scores1[0]); - assert.equal(results.topicData[1].lastposttime, results.scores2[0]); - assert.equal(results.topicData[0].lastposttime, results.scores1[1]); - assert.equal(results.topicData[1].lastposttime, results.scores2[1]); - assert.equal(results.topicData[0].postcount, results.scores1[2]); - assert.equal(results.topicData[1].postcount, results.scores2[2]); - assert.equal(results.topicData[0].lastposttime, post1.timestamp); - assert.equal(results.topicData[1].lastposttime, post2.timestamp); + var assertMsg = JSON.stringify(results.posts1) + '\n' + JSON.stringify(results.posts2); + assert.equal(results.topicData[0].postcount, results.scores1[2], assertMsg); + assert.equal(results.topicData[1].postcount, results.scores2[2], assertMsg); + assert.equal(results.topicData[0].lastposttime, post1.timestamp, assertMsg); + assert.equal(results.topicData[1].lastposttime, post2.timestamp, assertMsg); + assert.equal(results.topicData[0].lastposttime, results.scores1[0], assertMsg); + assert.equal(results.topicData[1].lastposttime, results.scores2[0], assertMsg); + assert.equal(results.topicData[0].lastposttime, results.scores1[1], assertMsg); + assert.equal(results.topicData[1].lastposttime, results.scores2[1], assertMsg); + next(); }, ], callback);