Skip to content

Node.js based forum software built for the modern web

closes #7060

Baris Usaklid3c6cba33f25
diff --git a/src/categories/index.js b/src/categories/index.js
index 35fd8f740f..37c7c97d3d 100644
--- a/src/categories/index.js
+++ b/src/categories/index.js
@@ -101,7 +101,7 @@ Categories.getAllCidsFromSet = function (key, callback) {
Categories.getAllCategories = function (uid, callback) {
async.waterfall([
function (next) {
- Categories.getAllCids(next);
+ Categories.getAllCidsFromSet('categories:cid', next);
},
function (cids, next) {
Categories.getCategories(cids, uid, next);
diff --git a/test/categories.js b/test/categories.js
index af11a3528b..448655acbc 100644
--- a/test/categories.js
+++ b/test/categories.js
@@ -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) {
request(nconf.get('url') + '/api/category/' + categoryObj.cid + '/test-category', { json: true }, function (err, response, body) {
assert.ifError(err);