v1.18.x
Julian Lam 8 years ago
parent b5f8fc815e
commit 995f8296a4

@ -1,6 +1,6 @@
(function (exports) { 'use strict';
'use strict';
(function (exports) {
/* globals define, utils, config */ /* globals define, utils, config */
// export the class if we are in a Node-like system. // export the class if we are in a Node-like system.

@ -68,7 +68,7 @@ module.exports = function (privileges) {
}, },
function (cid, next) { function (cid, next) {
privileges.categories.can(privilege, cid, uid, next); privileges.categories.can(privilege, cid, uid, next);
} },
], callback); ], callback);
}; };

@ -7,10 +7,8 @@ var db = require('./mocks/databasemock');
var helpers = require('../public/src/modules/helpers'); var helpers = require('../public/src/modules/helpers');
describe('helpers', function () { describe('helpers', function () {
it('should return false if item doesn\'t exist', function (done) { it('should return false if item doesn\'t exist', function (done) {
var flag = helpers.displayMenuItem({navigation: []}, 0); var flag = helpers.displayMenuItem({ navigation: [] }, 0);
assert(!flag); assert(!flag);
done(); done();
}); });
@ -18,11 +16,11 @@ describe('helpers', function () {
it('should return false if route is /users and privateUserInfo is on and user is not logged in', function (done) { it('should return false if route is /users and privateUserInfo is on and user is not logged in', function (done) {
var flag = helpers.displayMenuItem({ var flag = helpers.displayMenuItem({
navigation: [{route: '/users'}], navigation: [{ route: '/users' }],
privateUserInfo: true, privateUserInfo: true,
config: { config: {
loggedIn: false loggedIn: false,
} },
}, 0); }, 0);
assert(!flag); assert(!flag);
done(); done();
@ -30,18 +28,18 @@ describe('helpers', function () {
it('should return false if route is /tags and privateTagListing is on and user is not logged in', function (done) { it('should return false if route is /tags and privateTagListing is on and user is not logged in', function (done) {
var flag = helpers.displayMenuItem({ var flag = helpers.displayMenuItem({
navigation: [{route: '/tags'}], navigation: [{ route: '/tags' }],
privateTagListing: true, privateTagListing: true,
config: { config: {
loggedIn: false loggedIn: false,
} },
}, 0); }, 0);
assert(!flag); assert(!flag);
done(); done();
}); });
it('should stringify object', function (done) { it('should stringify object', function (done) {
var str = helpers.stringify({a: 'herp < derp > and & quote "'}); var str = helpers.stringify({ a: 'herp < derp > and & quote "' });
assert.equal(str, '{&quot;a&quot;:&quot;herp &lt; derp &gt; and &amp; quote \\&quot;&quot;}'); assert.equal(str, '{&quot;a&quot;:&quot;herp &lt; derp &gt; and &amp; quote \\&quot;&quot;}');
done(); done();
}); });
@ -51,5 +49,4 @@ describe('helpers', function () {
assert.equal(str, 'gdkfhgk &lt; some &gt; and &amp;'); assert.equal(str, 'gdkfhgk &lt; some &gt; and &amp;');
done(); done();
}); });
}); });

Loading…
Cancel
Save