mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 22:15:48 +01:00
closes #7060
This commit is contained in:
@@ -101,7 +101,7 @@ Categories.getAllCidsFromSet = function (key, callback) {
|
|||||||
Categories.getAllCategories = function (uid, callback) {
|
Categories.getAllCategories = function (uid, callback) {
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function (next) {
|
function (next) {
|
||||||
Categories.getAllCids(next);
|
Categories.getAllCidsFromSet('categories:cid', next);
|
||||||
},
|
},
|
||||||
function (cids, next) {
|
function (cids, next) {
|
||||||
Categories.getCategories(cids, uid, next);
|
Categories.getCategories(cids, uid, next);
|
||||||
|
|||||||
@@ -79,6 +79,15 @@ describe('Categories', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should get all categories', function (done) {
|
||||||
|
Categories.getAllCategories(1, function (err, data) {
|
||||||
|
assert.ifError(err);
|
||||||
|
assert(Array.isArray(data));
|
||||||
|
assert.equal(data[0].cid, categoryObj.cid);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should load a category route', function (done) {
|
it('should load a category route', function (done) {
|
||||||
request(nconf.get('url') + '/api/category/' + categoryObj.cid + '/test-category', { json: true }, function (err, response, body) {
|
request(nconf.get('url') + '/api/category/' + categoryObj.cid + '/test-category', { json: true }, function (err, response, body) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
|
|||||||
Reference in New Issue
Block a user