From fc0dce429bccab0b8a081781db8af272eda5adf7 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 12 Nov 2014 15:06:55 -0500 Subject: [PATCH] topic.reply checks with invalid parameters --- tests/topics.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/topics.js b/tests/topics.js index 9ca300d470..6ee2d3ca79 100644 --- a/tests/topics.js +++ b/tests/topics.js @@ -101,6 +101,27 @@ describe('Topic\'s', function() { done(); }); }); + + it('should fail to create new reply with invalid user id', function(done) { + topics.reply({uid: null, content: 'test post', tid: newTopic.tid}, function(err, result) { + assert.equal(err.message, '[[error:no-privileges]]'); + done(); + }); + }); + + it('should fail to create new reply with empty content', function(done) { + topics.reply({uid: topic.userId, content: '', tid: newTopic.tid}, function(err, result) { + assert.ok(err); + done(); + }); + }); + + it('should fail to create new reply with invalid topic id', function(done) { + topics.reply({uid: null, content: 'test post', tid: 99}, function(err, result) { + assert.equal(err.message, '[[error:no-topic]]'); + done(); + }); + }); }); describe('Get methods', function() {