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 */
// export the class if we are in a Node-like system.

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

@ -7,10 +7,8 @@ var db = require('./mocks/databasemock');
var helpers = require('../public/src/modules/helpers');
describe('helpers', function () {
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);
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) {
var flag = helpers.displayMenuItem({
navigation: [{route: '/users'}],
navigation: [{ route: '/users' }],
privateUserInfo: true,
config: {
loggedIn: false
}
loggedIn: false,
},
}, 0);
assert(!flag);
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) {
var flag = helpers.displayMenuItem({
navigation: [{route: '/tags'}],
navigation: [{ route: '/tags' }],
privateTagListing: true,
config: {
loggedIn: false
}
loggedIn: false,
},
}, 0);
assert(!flag);
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;}');
done();
});
@ -51,5 +49,4 @@ describe('helpers', function () {
assert.equal(str, 'gdkfhgk &lt; some &gt; and &amp;');
done();
});
});

Loading…
Cancel
Save