Node.js based forum software built for the modern web
added getTopicWithPosts test
barisusakli28331389a6fc
diff --git a/tests/topics.js b/tests/topics.jsindex dcf7f1067e..7103b32689 100644--- a/tests/topics.js+++ b/tests/topics.js@@ -132,7 +132,7 @@ describe('Topic\'s', function() {var newTopic;var newPost;- beforeEach(function(done) {+ before(function(done) {topics.post({uid: topic.userId, title: topic.title, content: topic.content, cid: topic.categoryId}, function(err, result) {newTopic = result.topicData;newPost = result.postData;@@ -145,6 +145,28 @@ describe('Topic\'s', function() {topics.getTopicData(newTopic.tid, done);});});++ describe('.getTopicWithPosts', function() {+ it('should get a topic with posts and other data', function(done) {+ topics.getTopicData(newTopic.tid, function(err, topicData) {+ if (err) {+ return done(err);+ }+ topics.getTopicWithPosts(topicData, 'tid:' + newTopic.tid + ':posts', topic.userId, 0, -1, false, function(err, data) {+ if (err) {+ return done(err);+ }+ assert(data);+ assert.equal(data.category.cid, topic.categoryId);+ assert.equal(data.unreplied, true);+ assert.equal(data.deleted, false);+ assert.equal(data.locked, false);+ assert.equal(data.pinned, false);+ done();+ });+ });+ });+ });});describe('Title escaping', function() {