From 4e23fe7c3a6d15e57cc86c173008d75e0604065c Mon Sep 17 00:00:00 2001 From: barisusakli Date: Tue, 11 Nov 2014 23:12:37 -0500 Subject: [PATCH] more topic post tests --- tests/topics.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/topics.js b/tests/topics.js index b0dcaf5655..3a265af2cd 100644 --- a/tests/topics.js +++ b/tests/topics.js @@ -52,12 +52,33 @@ describe('Topic\'s', function() { }); }); - it('should fail to create new topic with wrong parameters', function(done) { + it('should fail to create new topic with invalid user id', function(done) { topics.post({uid: null, title: topic.title, content: topic.content, cid: topic.categoryId}, function(err, result) { assert.equal(err.message, '[[error:no-privileges]]'); done(); }); }); + + it('should fail to create new topic with empty title', function(done) { + topics.post({uid: topic.userId, title: '', content: topic.content, cid: topic.categoryId}, function(err, result) { + assert.equal(err); + done(); + }); + }); + + it('should fail to create new topic with empty content', function(done) { + topics.post({uid: topic.userId, title: topic.title, content: '', cid: topic.categoryId}, function(err, result) { + assert.equal(err); + done(); + }); + }); + + it('should fail to create new topic with non-existant category id', function(done) { + topics.post({uid: topic.userId, title: topic.title, content: topic.content, cid: 99}, function(err, result) { + assert.equal(err,message, '[[error:no-category]]'); + done(); + }); + }); }); describe('Get methods', function() {