mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 07:55:46 +01:00
another dependency fix and test
This commit is contained in:
@@ -5,7 +5,6 @@ var db = require('../database');
|
|||||||
var batch = require('../batch');
|
var batch = require('../batch');
|
||||||
var plugins = require('../plugins');
|
var plugins = require('../plugins');
|
||||||
var topics = require('../topics');
|
var topics = require('../topics');
|
||||||
var privileges = require('../privileges');
|
|
||||||
var groups = require('../groups');
|
var groups = require('../groups');
|
||||||
|
|
||||||
module.exports = function(Categories) {
|
module.exports = function(Categories) {
|
||||||
@@ -46,6 +45,7 @@ module.exports = function(Categories) {
|
|||||||
], next);
|
], next);
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
|
var privileges = require('../privileges');
|
||||||
async.each(privileges.privilegeList, function(privilege, next) {
|
async.each(privileges.privilegeList, function(privilege, next) {
|
||||||
groups.destroy('cid:' + cid + ':privileges:' + privilege, next);
|
groups.destroy('cid:' + cid + ':privileges:' + privilege, next);
|
||||||
}, next);
|
}, next);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ var db = require('../database');
|
|||||||
var posts = require('../posts');
|
var posts = require('../posts');
|
||||||
var topics = require('../topics');
|
var topics = require('../topics');
|
||||||
var categories = require('../categories');
|
var categories = require('../categories');
|
||||||
var privileges = require('../privileges');
|
|
||||||
|
|
||||||
module.exports = function(Categories) {
|
module.exports = function(Categories) {
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ module.exports = function(Categories) {
|
|||||||
if (!parseInt(count, 10)) {
|
if (!parseInt(count, 10)) {
|
||||||
return callback(null, []);
|
return callback(null, []);
|
||||||
}
|
}
|
||||||
|
var privileges = require('../privileges');
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function(next) {
|
function(next) {
|
||||||
db.getSortedSetRevRange('cid:' + cid + ':pids', 0, count - 1, next);
|
db.getSortedSetRevRange('cid:' + cid + ':pids', 0, count - 1, next);
|
||||||
@@ -36,7 +36,7 @@ module.exports = function(Categories) {
|
|||||||
if (!Array.isArray(categoryData) || !categoryData.length) {
|
if (!Array.isArray(categoryData) || !categoryData.length) {
|
||||||
return callback();
|
return callback();
|
||||||
}
|
}
|
||||||
|
var privileges = require('../privileges');
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function(next) {
|
function(next) {
|
||||||
async.map(categoryData, getRecentTopicTids, next);
|
async.map(categoryData, getRecentTopicTids, next);
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var async = require('async'),
|
var async = require('async');
|
||||||
db = require('../database');
|
var db = require('../database');
|
||||||
|
|
||||||
module.exports = function(Categories) {
|
module.exports = function(Categories) {
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var async = require('async'),
|
var async = require('async');
|
||||||
db = require('../database'),
|
var db = require('../database');
|
||||||
utils = require('../../public/src/utils'),
|
var utils = require('../../public/src/utils');
|
||||||
translator = require('../../public/src/modules/translator'),
|
var translator = require('../../public/src/modules/translator');
|
||||||
plugins = require('../plugins');
|
var plugins = require('../plugins');
|
||||||
|
|
||||||
module.exports = function(Categories) {
|
module.exports = function(Categories) {
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,25 @@ describe('Categories', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Categories.getRecentTopicReplies', function() {
|
||||||
|
it('should not throw', function(done) {
|
||||||
|
Categories.getCategoryById({
|
||||||
|
cid: categoryObj.cid,
|
||||||
|
set: 'cid:' + categoryObj.cid + ':tids',
|
||||||
|
reverse: true,
|
||||||
|
start: 0,
|
||||||
|
stop: -1,
|
||||||
|
uid: 0
|
||||||
|
}, function(err, categoryData) {
|
||||||
|
assert.ifError(err);
|
||||||
|
Categories.getRecentTopicReplies(categoryData, 0, function(err) {
|
||||||
|
assert.ifError(err);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('.getCategoryTopics', function() {
|
describe('.getCategoryTopics', function() {
|
||||||
it('should return a list of topics', function(done) {
|
it('should return a list of topics', function(done) {
|
||||||
Categories.getCategoryTopics({
|
Categories.getCategoryTopics({
|
||||||
|
|||||||
Reference in New Issue
Block a user