category route test

v1.18.x
barisusakli 8 years ago
parent f683a1fe62
commit cec3b650c3

@ -4,6 +4,8 @@
var async = require('async');
var assert = require('assert');
var nconf = require('nconf');
var request = require('request');
var db = require('./mocks/databasemock');
var Categories = require('../src/categories');
@ -26,7 +28,7 @@ describe('Categories', function () {
});
});
describe('.create', function () {
it('should create a new category', function (done) {
Categories.create({
@ -36,15 +38,13 @@ describe('Categories', function () {
blockclass: 'category-blue',
order: '5'
}, function (err, category) {
assert.equal(err, null);
assert.ifError(err);
categoryObj = category;
done.apply(this, arguments);
});
done();
});
});
describe('.getCategoryById', function () {
it('should retrieve a newly created category by its ID', function (done) {
Categories.getCategoryById({
cid: categoryObj.cid,
@ -63,6 +63,15 @@ describe('Categories', function () {
done();
});
});
it('should load a category route', function (done) {
request(nconf.get('url') + '/category/' + categoryObj.cid + '/test-category', function (err, response, body) {
assert.ifError(err);
assert.equal(response.statusCode, 200);
assert(body);
done();
});
});
describe('Categories.getRecentTopicReplies', function () {

Loading…
Cancel
Save