ESlint comma-dangle

This commit is contained in:
Peter Jaszkowiak
2017-02-17 19:31:21 -07:00
parent aa64ec7db1
commit bc1d70c126
345 changed files with 1974 additions and 1978 deletions

View File

@@ -23,7 +23,7 @@ describe('authentication', function () {
request({
url: nconf.get('url') + '/api/config',
json: true,
jar: jar
jar: jar,
}, function (err, response, body) {
assert.ifError(err);
@@ -36,8 +36,8 @@ describe('authentication', function () {
json: true,
jar: jar,
headers: {
'x-csrf-token': body.csrf_token
}
'x-csrf-token': body.csrf_token,
},
}, function (err, response, body) {
assert.ifError(err);
assert(body);
@@ -45,7 +45,7 @@ describe('authentication', function () {
request({
url: nconf.get('url') + '/api/me',
json: true,
jar: jar
jar: jar,
}, function (err, response, body) {
assert.ifError(err);
assert(body);
@@ -61,7 +61,7 @@ describe('authentication', function () {
request({
url: nconf.get('url') + '/api/config',
json: true,
jar: jar
jar: jar,
}, function (err, response, body) {
assert.ifError(err);
@@ -70,15 +70,15 @@ describe('authentication', function () {
json: true,
jar: jar,
headers: {
'x-csrf-token': body.csrf_token
}
'x-csrf-token': body.csrf_token,
},
}, function (err) {
assert.ifError(err);
request({
url: nconf.get('url') + '/api/me',
json: true,
jar: jar
jar: jar,
}, function (err, response, body) {
assert.ifError(err);
assert.equal(body, 'not-authorized');
@@ -93,7 +93,7 @@ describe('authentication', function () {
request({
url: nconf.get('url') + '/api/config',
json: true,
jar: jar
jar: jar,
}, function (err, response, body) {
assert.ifError(err);
@@ -105,8 +105,8 @@ describe('authentication', function () {
json: true,
jar: jar,
headers: {
'x-csrf-token': body.csrf_token
}
'x-csrf-token': body.csrf_token,
},
}, function (err, response, body) {
assert.ifError(err);
assert(body);
@@ -114,7 +114,7 @@ describe('authentication', function () {
request({
url: nconf.get('url') + '/api/me',
json: true,
jar: jar
jar: jar,
}, function (err, response, body) {
assert.ifError(err);
assert(body);

View File

@@ -27,7 +27,7 @@ describe('Categories', function () {
},
adminUid: function (next) {
User.create({username: 'admin'}, next);
}
},
}, function (err, results) {
assert.ifError(err);
posterUid = results.posterUid;
@@ -44,7 +44,7 @@ describe('Categories', function () {
description: 'Test category created by testing script',
icon: 'fa-check',
blockclass: 'category-blue',
order: '5'
order: '5',
}, function (err, category) {
assert.ifError(err);
@@ -60,7 +60,7 @@ describe('Categories', function () {
reverse: true,
start: 0,
stop: -1,
uid: 0
uid: 0,
}, function (err, categoryData) {
assert.equal(err, null);
@@ -90,7 +90,7 @@ describe('Categories', function () {
reverse: true,
start: 0,
stop: -1,
uid: 0
uid: 0,
}, function (err, categoryData) {
assert.ifError(err);
Categories.getRecentTopicReplies(categoryData, 0, function (err) {
@@ -109,7 +109,7 @@ describe('Categories', function () {
reverse: true,
start: 0,
stop: 10,
uid: 0
uid: 0,
}, function (err, result) {
assert.equal(err, null);
@@ -130,7 +130,7 @@ describe('Categories', function () {
start: 0,
stop: 10,
uid: 0,
targetUid: 1
targetUid: 1,
}, function (err, result) {
assert.equal(err, null);
assert(Array.isArray(result.topics));
@@ -151,7 +151,7 @@ describe('Categories', function () {
category: function (next) {
Categories.create({
name: 'Test Category 2',
description: 'Test category created by testing script'
description: 'Test category created by testing script',
}, next);
},
topic: function (next) {
@@ -159,9 +159,9 @@ describe('Categories', function () {
uid: posterUid,
cid: categoryObj.cid,
title: 'Test Topic Title',
content: 'The content of test topic'
content: 'The content of test topic',
}, next);
}
},
}, function (err, results) {
if (err) {
return done(err);
@@ -199,7 +199,7 @@ describe('Categories', function () {
cid: categoryObj.cid,
title: 'Test Topic Title',
content: 'The content of test topic',
tags: ['nodebb']
tags: ['nodebb'],
}, done);
});
@@ -318,7 +318,7 @@ describe('Categories', function () {
description: 'update description',
parentCid: categoryObj.cid,
icon: 'fa-check',
order: '5'
order: '5',
}, function (err, category) {
assert.ifError(err);
@@ -337,7 +337,7 @@ describe('Categories', function () {
it('should error if you try to set parent as self', function (done) {
var updateData = {};
updateData[cid] = {
parentCid: cid
parentCid: cid,
};
socketCategories.update({uid: adminUid}, updateData, function (err) {
assert.equal(err.message, '[[error:cant-set-self-as-parent]]');
@@ -352,7 +352,7 @@ describe('Categories', function () {
description: 'new description',
parentCid: 0,
order: 3,
icon: 'fa-hammer'
icon: 'fa-hammer',
};
socketCategories.update({uid: adminUid}, updateData, function (err) {
assert.ifError(err);
@@ -371,14 +371,14 @@ describe('Categories', function () {
it('should purge category', function (done) {
Categories.create({
name: 'purge me',
description: 'update description'
description: 'update description',
}, function (err, category) {
assert.ifError(err);
Topics.post({
uid: posterUid,
cid: category.cid,
title: 'Test Topic Title',
content: 'The content of test topic'
content: 'The content of test topic',
}, function (err) {
assert.ifError(err);
socketCategories.purge({uid: adminUid}, category.cid, function (err) {
@@ -464,7 +464,7 @@ describe('Categories', function () {
function (canDelete, next) {
assert(canDelete);
next();
}
},
], done);
});
@@ -489,7 +489,7 @@ describe('Categories', function () {
function (description, next) {
assert.equal(description, 'copy me');
next();
}
},
], done);
});
@@ -517,21 +517,21 @@ describe('Categories', function () {
function (canDelete, next) {
assert(canDelete);
next();
}
},
], done);
});
});
it('should get active users', function (done) {
Categories.create({
name: 'test'
name: 'test',
}, function (err, category) {
assert.ifError(err);
Topics.post({
uid: posterUid,
cid: category.cid,
title: 'Test Topic Title',
content: 'The content of test topic'
content: 'The content of test topic',
}, function (err) {
assert.ifError(err);
Categories.getActiveUsers(category.cid, function (err, uids) {
@@ -548,7 +548,7 @@ describe('Categories', function () {
var socketTopics = require('../src/socket.io/topics');
before(function (done) {
Categories.create({
name: 'test'
name: 'test',
}, function (err, category) {
assert.ifError(err);
cid = category.cid;
@@ -574,7 +574,7 @@ describe('Categories', function () {
it('should add tags to category whitelist', function (done) {
var data = {};
data[cid] = {
tagWhitelist: 'nodebb,jquery,javascript'
tagWhitelist: 'nodebb,jquery,javascript',
};
Categories.update(data, function (err) {
assert.ifError(err);
@@ -608,7 +608,7 @@ describe('Categories', function () {
cid: cid,
title: 'Test Topic Title',
content: 'The content of test topic',
tags: ['nodebb', 'jquery', 'notallowed']
tags: ['nodebb', 'jquery', 'notallowed'],
}, function (err, data) {
assert.ifError(err);
assert.equal(data.topicData.tags.length, 2);

View File

@@ -26,7 +26,7 @@ describe('Admin Controllers', function () {
category: function (next) {
categories.create({
name: 'Test Category',
description: 'Test category created by testing script'
description: 'Test category created by testing script',
}, next);
},
adminUid: function (next) {
@@ -34,7 +34,7 @@ describe('Admin Controllers', function () {
},
regularUid: function (next) {
user.create({username: 'regular'}, next);
}
},
}, function (err, results) {
if (err) {
return done(err);

View File

@@ -24,12 +24,12 @@ describe('Controllers', function () {
category: function (next) {
categories.create({
name: 'Test Category',
description: 'Test category created by testing script'
description: 'Test category created by testing script',
}, next);
},
user: function (next) {
user.create({username: 'foo', password: 'barbar'}, next);
}
},
}, function (err, results) {
if (err) {
return done(err);
@@ -438,7 +438,7 @@ describe('Controllers', function () {
groups.create({
name: 'group-details',
description: 'Foobar!',
hidden: 0
hidden: 0,
}, function (err) {
assert.ifError(err);
request(nconf.get('url') + '/groups/group-details', function (err, res, body) {
@@ -464,7 +464,7 @@ describe('Controllers', function () {
groups.create({
name: 'hidden-group',
description: 'Foobar!',
hidden: 1
hidden: 1,
}, function (err) {
assert.ifError(err);
request(nconf.get('url') + '/groups/hidden-group/members', function (err, res, body) {
@@ -525,8 +525,8 @@ describe('Controllers', function () {
request.del(nconf.get('url') + '/api/user/revokeme/session', {
jar: jar,
headers: {
'x-csrf-token': csrf_token
}
'x-csrf-token': csrf_token,
},
}, function (err, res, body) {
assert.ifError(err);
assert.equal(res.statusCode, 404);
@@ -538,8 +538,8 @@ describe('Controllers', function () {
request.del(nconf.get('url') + '/api/user/doesnotexist/session/1112233', {
jar: jar,
headers: {
'x-csrf-token': csrf_token
}
'x-csrf-token': csrf_token,
},
}, function (err, res, body) {
assert.ifError(err);
assert.equal(res.statusCode, 403);
@@ -558,8 +558,8 @@ describe('Controllers', function () {
request.del(nconf.get('url') + '/api/user/revokeme/session/' + sessionObj.meta.uuid, {
jar: jar,
headers: {
'x-csrf-token': csrf_token
}
'x-csrf-token': csrf_token,
},
}, function (err, res, body) {
assert.ifError(err);
assert.equal(res.statusCode, 200);
@@ -591,15 +591,15 @@ describe('Controllers', function () {
data: {
html: 'test',
title: '',
container: ''
}
} ]
}
]
container: '',
},
} ],
},
],
};
widgets.setArea(data, next);
}
},
], done);
});
@@ -632,7 +632,7 @@ describe('Controllers', function () {
title: 'topic title',
content: 'test topic content',
cid: cid,
tags: ['nodebb', 'bug', 'test']
tags: ['nodebb', 'bug', 'test'],
}, function (err, result) {
assert.ifError(err);
tid = result.topicData.tid;
@@ -806,7 +806,7 @@ describe('Controllers', function () {
tid: 1,
from: fooUid,
mergeId: 'notifications:user_posted_to|' + 1,
topicTitle: 'topic title'
topicTitle: 'topic title',
};
async.waterfall([
function (next) {
@@ -831,7 +831,7 @@ describe('Controllers', function () {
assert.equal(notif.path, notifData.path);
assert.equal(notif.nid, notifData.nid);
next();
}
},
], done);
});
});

View File

@@ -9,7 +9,7 @@ describe('Hash methods', function () {
var testData = {
name: 'baris',
lastname: 'usakli',
age: 99
age: 99,
};
beforeEach(function (done) {
@@ -87,7 +87,7 @@ describe('Hash methods', function () {
before(function (done) {
async.parallel([
async.apply(db.setObject, 'testObject4', {name: 'baris'}),
async.apply(db.setObjectField, 'testObject5', 'name', 'ginger')
async.apply(db.setObjectField, 'testObject5', 'name', 'ginger'),
], done);
});
@@ -162,7 +162,7 @@ describe('Hash methods', function () {
before(function (done) {
async.parallel([
async.apply(db.setObject, 'testObject8', {name: 'baris', age:99}),
async.apply(db.setObject, 'testObject9', {name: 'ginger', age: 3})
async.apply(db.setObject, 'testObject9', {name: 'ginger', age: 3}),
], done);
});
@@ -299,7 +299,7 @@ describe('Hash methods', function () {
assert.equal(arguments.length, 1);
async.parallel({
delete1: async.apply(db.isObjectField, 'testObject10', 'delete1'),
delete2: async.apply(db.isObjectField, 'testObject10', 'delete2')
delete2: async.apply(db.isObjectField, 'testObject10', 'delete2'),
}, function (err, results) {
assert.ifError(err);
assert.equal(results.delete1, false);

View File

@@ -78,7 +78,7 @@ describe('Key methods', function () {
},
function (next) {
db.set('key2', 'value2', next);
}
},
], function (err) {
if (err) {
return done(err);
@@ -92,7 +92,7 @@ describe('Key methods', function () {
},
key2exists: function (next) {
db.exists('key2', next);
}
},
}, function (err, results) {
assert.equal(err, null);
assert.equal(results.key1exists, false);

View File

@@ -33,7 +33,7 @@ describe('List methods', function () {
},
function (next) {
db.listPrepend('testList2', 1, next);
}
},
], function (err) {
assert.equal(err, null);
done();
@@ -52,7 +52,7 @@ describe('List methods', function () {
},
function (next) {
db.listAppend('testList4', 5, next);
}
},
], done);
});
@@ -94,7 +94,7 @@ describe('List methods', function () {
},
function (next) {
db.listPrepend('testList4', 9, next);
}
},
], done);
});
@@ -115,7 +115,7 @@ describe('List methods', function () {
async.apply(db.listAppend, 'testList5', 1),
async.apply(db.listAppend, 'testList5', 1),
async.apply(db.listAppend, 'testList5', 2),
async.apply(db.listAppend, 'testList5', 5)
async.apply(db.listAppend, 'testList5', 5),
], done);
});

View File

@@ -157,7 +157,7 @@ describe('Set methods', function () {
async.parallel([
async.apply(db.setAdd, 'set5', [1,2,3,4,5]),
async.apply(db.setAdd, 'set6', 1),
async.apply(db.setAdd, 'set7', 2)
async.apply(db.setAdd, 'set7', 2),
], done);
});

View File

@@ -20,7 +20,7 @@ describe('Sorted Set methods', function () {
},
function (next) {
db.sortedSetAdd('sortedSetLex', [0, 0, 0, 0], ['a', 'b', 'c', 'd'], next);
}
},
], done);
});
@@ -565,7 +565,7 @@ describe('Sorted Set methods', function () {
},
function (next) {
db.sortedSetAdd('interSet2', [4,5,6], ['value2', 'value3', 'value5'], next);
}
},
], done);
});
@@ -573,7 +573,7 @@ describe('Sorted Set methods', function () {
db.getSortedSetIntersect({
sets: ['interSet1', 'interSet2'],
start: 0,
stop: -1
stop: -1,
}, function (err, data) {
assert.ifError(err);
assert.deepEqual(['value2', 'value3'], data);
@@ -586,7 +586,7 @@ describe('Sorted Set methods', function () {
sets: ['interSet1', 'interSet2'],
start: 0,
stop: -1,
withScores: true
withScores: true,
}, function (err, data) {
assert.ifError(err);
assert.deepEqual([{value: 'value2', score: 6}, {value: 'value3', score: 8}], data);
@@ -600,7 +600,7 @@ describe('Sorted Set methods', function () {
start: 0,
stop: -1,
withScores: true,
aggregate: 'MIN'
aggregate: 'MIN',
}, function (err, data) {
assert.ifError(err);
assert.deepEqual([{value: 'value2', score: 2}, {value: 'value3', score: 3}], data);
@@ -614,7 +614,7 @@ describe('Sorted Set methods', function () {
start: 0,
stop: -1,
withScores: true,
aggregate: 'MAX'
aggregate: 'MAX',
}, function (err, data) {
assert.ifError(err);
assert.deepEqual([{value: 'value2', score: 4}, {value: 'value3', score: 5}], data);
@@ -628,7 +628,7 @@ describe('Sorted Set methods', function () {
start: 0,
stop: -1,
withScores: true,
weights: [1, 0.5]
weights: [1, 0.5],
}, function (err, data) {
assert.ifError(err);
assert.deepEqual([{value: 'value2', score: 4}, {value: 'value3', score: 5.5}], data);
@@ -640,7 +640,7 @@ describe('Sorted Set methods', function () {
db.getSortedSetIntersect({
sets: ['interSet10', 'interSet12'],
start: 0,
stop: -1
stop: -1,
}, function (err, data) {
assert.ifError(err);
assert.equal(data.length, 0);
@@ -652,7 +652,7 @@ describe('Sorted Set methods', function () {
db.getSortedSetIntersect({
sets: ['interSet1', 'interSet12'],
start: 0,
stop: -1
stop: -1,
}, function (err, data) {
assert.ifError(err);
assert.equal(data.length, 0);
@@ -676,7 +676,7 @@ describe('Sorted Set methods', function () {
},
function (next) {
db.sortedSetAdd('interCard4', [0, 0, 0], ['value4', 'value5', 'value6'], next);
}
},
], done);
});

File diff suppressed because one or more lines are too long

View File

@@ -14,7 +14,7 @@ helpers.loginUser = function (username, password, callback) {
request({
url: nconf.get('url') + '/api/config',
json: true,
jar: jar
jar: jar,
}, function (err, res, body) {
if (err || res.statusCode !== 200) {
return callback(err || new Error('[[error:invalid-response]]'));
@@ -28,8 +28,8 @@ helpers.loginUser = function (username, password, callback) {
json: true,
jar: jar,
headers: {
'x-csrf-token': body.csrf_token
}
'x-csrf-token': body.csrf_token,
},
}, function (err, res) {
if (err || res.statusCode !== 200) {
return callback(err || new Error('[[error:invalid-response]]'));
@@ -62,7 +62,7 @@ helpers.initSocketIO = function (callback) {
request.get({
url: nconf.get('url') + '/api/config',
jar: jar,
json: true
json: true,
}, function (err, res, body) {
if (err) {
return callback(err);
@@ -94,8 +94,8 @@ helpers.uploadFile = function (uploadEndPoint, filePath, body, jar, csrf_token,
var formData = {
files: [
fs.createReadStream(filePath),
fs.createReadStream(filePath) // see https://github.com/request/request/issues/2445
]
fs.createReadStream(filePath), // see https://github.com/request/request/issues/2445
],
};
formData = utils.merge(formData, body);
request.post({
@@ -104,8 +104,8 @@ helpers.uploadFile = function (uploadEndPoint, filePath, body, jar, csrf_token,
json: true,
jar: jar,
headers: {
'x-csrf-token': csrf_token
}
'x-csrf-token': csrf_token,
},
}, function (err, res, body) {
if (err) {
return callback(err);
@@ -119,7 +119,7 @@ helpers.registerUser = function (data, callback) {
request({
url: nconf.get('url') + '/api/config',
json: true,
jar: jar
jar: jar,
}, function (err, response, body) {
if (err) {
return callback(err);
@@ -130,8 +130,8 @@ helpers.registerUser = function (data, callback) {
json: true,
jar: jar,
headers: {
'x-csrf-token': body.csrf_token
}
'x-csrf-token': body.csrf_token,
},
}, function (err, res, body) {
if (err) {
return callback(err);

View File

@@ -25,7 +25,7 @@ describe('Messaging Library', function () {
async.series([
async.apply(User.create, { username: 'foo', password: 'barbar' }), // admin
async.apply(User.create, { username: 'baz', password: 'quuxquux' }), // restricted user
async.apply(User.create, { username: 'herp', password: 'derpderp' }) // regular user
async.apply(User.create, { username: 'herp', password: 'derpderp' }), // regular user
], function (err, uids) {
if (err) {
return done(err);
@@ -37,7 +37,7 @@ describe('Messaging Library', function () {
async.parallel([
async.apply(Groups.join, 'administrators', fooUid),
async.apply(User.setSetting, bazUid, 'restrictChat', '1')
async.apply(User.setSetting, bazUid, 'restrictChat', '1'),
], done);
});
});
@@ -125,7 +125,7 @@ describe('Messaging Library', function () {
socketModules.chats.getMessages({uid: fooUid}, {
uid: fooUid,
roomId: roomId,
start: 0
start: 0,
}, function (err, messages) {
assert.ifError(err);
assert(Array.isArray(messages));

View File

@@ -19,7 +19,7 @@ describe('meta', function () {
async.series([
async.apply(User.create, { username: 'foo', password: 'barbar' }), // admin
async.apply(User.create, { username: 'baz', password: 'quuxquux' }), // restricted user
async.apply(User.create, { username: 'herp', password: 'derpderp' }) // regular user
async.apply(User.create, { username: 'herp', password: 'derpderp' }), // regular user
], function (err, uids) {
if (err) {
return done(err);
@@ -146,7 +146,7 @@ describe('meta', function () {
socketAdmin.config.setMultiple({uid: fooUid}, {
someField1: 'someValue1',
someField2: 'someValue2',
customCSS: '.derp{color:#00ff00;}'
customCSS: '.derp{color:#00ff00;}',
}, function (err) {
assert.ifError(err);
meta.configs.getFields(['someField1', 'someField2'], function (err, data) {

View File

@@ -21,7 +21,7 @@
themes_path: path.join(__dirname, '../../node_modules'),
upload_path: 'public/uploads',
views_dir: path.join(__dirname, '../../build/public/templates'),
relative_path: ''
relative_path: '',
});
if (!nconf.get('isCluster')) {
@@ -60,7 +60,7 @@
' "password": "",' + '\n' +
' "database": "nodebb_test"' + '\n' +
'}\n' +
'==========================================================='
'===========================================================',
);
winston.error(errorText);
throw new Error(errorText);
@@ -116,7 +116,7 @@
function (next) {
meta.themes.set({
type: 'local',
id: 'nodebb-theme-persona'
id: 'nodebb-theme-persona',
}, next);
},
function (next) {
@@ -151,7 +151,7 @@
require('../../src/user').startJobs();
webserver.listen(next);
}
},
], done);
});
@@ -167,7 +167,7 @@
winston.info('Enabling default plugins\n');
var defaultEnabled = [
'nodebb-plugin-dbsearch'
'nodebb-plugin-dbsearch',
];
winston.info('[install/enableDefaultPlugins] activating default plugins', defaultEnabled);

View File

@@ -29,7 +29,7 @@ describe('Notifications', function () {
notifications.create({
bodyShort: 'bodyShort',
nid: 'notification_id',
path: '/notification/path'
path: '/notification/path',
}, function (err, _notification) {
notification = _notification;
assert.ifError(err);
@@ -162,7 +162,7 @@ describe('Notifications', function () {
categories.create({
name: 'Test Category',
description: 'Test category created by testing script'
description: 'Test category created by testing script',
}, next);
},
function (category, next) {
@@ -172,7 +172,7 @@ describe('Notifications', function () {
uid: watcherUid,
cid: cid,
title: 'Test Topic Title',
content: 'The content of test topic'
content: 'The content of test topic',
}, next);
},
function (topic, next) {
@@ -184,7 +184,7 @@ describe('Notifications', function () {
topics.reply({
uid: uid,
content: 'This is the first reply.',
tid: tid
tid: tid,
}, next);
},
function (post, next) {
@@ -193,7 +193,7 @@ describe('Notifications', function () {
topics.reply({
uid: uid,
content: 'This is the second reply.',
tid: tid
tid: tid,
}, next);
},
function (post, next) {
@@ -207,7 +207,7 @@ describe('Notifications', function () {
assert.equal(notifications.unread.length, 1, 'there should be 1 unread notification');
assert.equal('/post/' + pid, notifications.unread[0].path, 'the notification should link to the first unread post');
next();
}
},
], function (err) {
assert.ifError(err);
done();

View File

@@ -35,9 +35,9 @@ describe('Post\'s', function () {
category: function (next) {
categories.create({
name: 'Test Category',
description: 'Test category created by testing script'
description: 'Test category created by testing script',
}, next);
}
},
}, function (err, results) {
if (err) {
return done(err);
@@ -52,7 +52,7 @@ describe('Post\'s', function () {
uid: results.voteeUid,
cid: results.category.cid,
title: 'Test Topic Title',
content: 'The content of test topic'
content: 'The content of test topic',
}, function (err, data) {
if (err) {
return done(err);
@@ -190,14 +190,14 @@ describe('Post\'s', function () {
uid: voterUid,
cid: cid,
title: 'topic to delete/restore/purge',
content: 'A post to delete/restore/purge'
content: 'A post to delete/restore/purge',
}, function (err, topicPostData) {
assert.ifError(err);
topics.reply({
uid: voterUid,
tid: topicPostData.topicData.tid,
timestamp: Date.now(),
content: 'A post to delete/restore and purge'
content: 'A post to delete/restore and purge',
}, function (err, replyData) {
assert.ifError(err);
callback(topicPostData, replyData);
@@ -307,7 +307,7 @@ describe('Post\'s', function () {
uid: voterUid,
cid: cid,
title: 'topic to edit',
content: 'A post to edit'
content: 'A post to edit',
}, function (err, data) {
assert.ifError(err);
pid = data.postData.pid;
@@ -316,7 +316,7 @@ describe('Post\'s', function () {
uid: voterUid,
tid: tid,
timestamp: Date.now(),
content: 'A reply to edit'
content: 'A reply to edit',
}, function (err, data) {
assert.ifError(err);
replyPid = data.pid;
@@ -440,7 +440,7 @@ describe('Post\'s', function () {
uid: voterUid,
cid: cid,
title: 'topic 1',
content: 'some content'
content: 'some content',
}, next);
},
function (data, next) {
@@ -449,7 +449,7 @@ describe('Post\'s', function () {
uid: voterUid,
cid: cid,
title: 'topic 2',
content: 'some content'
content: 'some content',
}, next);
},
function (data, next) {
@@ -458,13 +458,13 @@ describe('Post\'s', function () {
uid: voterUid,
tid: tid,
timestamp: Date.now(),
content: 'A reply to move'
content: 'A reply to move',
}, function (err, data) {
assert.ifError(err);
replyPid = data.pid;
next();
});
}
},
], done);
});
@@ -587,8 +587,8 @@ describe('Post\'s', function () {
pid: postData.pid,
data: [
{name: 'assignee', value: `${globalModUid}`},
{name: 'notes', value: 'notes'}
]
{name: 'notes', value: 'notes'},
],
}, function (err) {
assert.ifError(err);
posts.getFlags('posts:flagged', cid, globalModUid, 0, -1, function (err, flagData) {
@@ -599,19 +599,19 @@ describe('Post\'s', function () {
assignee: flagData.posts[0].flagData.assignee,
notes: flagData.posts[0].flagData.notes,
state: flagData.posts[0].flagData.state,
labelClass: flagData.posts[0].flagData.labelClass
labelClass: flagData.posts[0].flagData.labelClass,
}, {
assignee: `${globalModUid}`,
notes: 'notes',
state: 'open',
labelClass: 'info'
labelClass: 'info',
});
next();
});
});
}, function (next) {
posts.updateFlagData(globalModUid, postData.pid, {
state: 'rejected'
state: 'rejected',
}, function (err) {
assert.ifError(err);
posts.getFlags('posts:flagged', cid, globalModUid, 0, -1, function (err, flagData) {
@@ -620,17 +620,17 @@ describe('Post\'s', function () {
assert.equal(flagData.posts.length, 1);
assert.deepEqual({
state: flagData.posts[0].flagData.state,
labelClass: flagData.posts[0].flagData.labelClass
labelClass: flagData.posts[0].flagData.labelClass,
}, {
state: 'rejected',
labelClass: 'danger'
labelClass: 'danger',
});
next();
});
});
}, function (next) {
posts.updateFlagData(globalModUid, postData.pid, {
state: 'wip'
state: 'wip',
}, function (err) {
assert.ifError(err);
posts.getFlags('posts:flagged', cid, globalModUid, 0, -1, function (err, flagData) {
@@ -639,17 +639,17 @@ describe('Post\'s', function () {
assert.equal(flagData.posts.length, 1);
assert.deepEqual({
state: flagData.posts[0].flagData.state,
labelClass: flagData.posts[0].flagData.labelClass
labelClass: flagData.posts[0].flagData.labelClass,
}, {
state: 'wip',
labelClass: 'warning'
labelClass: 'warning',
});
next();
});
});
}, function (next) {
posts.updateFlagData(globalModUid, postData.pid, {
state: 'resolved'
state: 'resolved',
}, function (err) {
assert.ifError(err);
posts.getFlags('posts:flagged', cid, globalModUid, 0, -1, function (err, flagData) {
@@ -658,15 +658,15 @@ describe('Post\'s', function () {
assert.equal(flagData.posts.length, 1);
assert.deepEqual({
state: flagData.posts[0].flagData.state,
labelClass: flagData.posts[0].flagData.labelClass
labelClass: flagData.posts[0].flagData.labelClass,
}, {
state: 'resolved',
labelClass: 'success'
labelClass: 'success',
});
next();
});
});
}
},
], done);
});
});
@@ -742,7 +742,7 @@ describe('Post\'s', function () {
uid: voterUid,
tid: topicData.tid,
timestamp: Date.now(),
content: 'some content'
content: 'some content',
}, function (err) {
assert.ifError(err);
posts.getRecentPosterUids(0, 1, function (err, uids) {

View File

@@ -19,7 +19,7 @@ describe('rewards', function () {
async.series([
async.apply(User.create, { username: 'foo', password: 'barbar' }),
async.apply(User.create, { username: 'baz', password: 'quuxquux' }),
async.apply(User.create, { username: 'herp', password: 'derpderp' })
async.apply(User.create, { username: 'herp', password: 'derpderp' }),
], function (err, uids) {
if (err) {
return done(err);
@@ -35,7 +35,7 @@ describe('rewards', function () {
},
function (next) {
Groups.join('rewardGroup', adminUid, done);
}
},
], done);
});
});
@@ -53,8 +53,8 @@ describe('rewards', function () {
rid: 'essentials/add-to-group',
claimable: '1',
id: '',
disabled: false
}
disabled: false,
},
];
socketAdmin.rewards.save({uid: adminUid}, data, function (err) {

View File

@@ -40,7 +40,7 @@ describe('admin search', function () {
search.sanitize('Pellentesque tristique senectus' +
'<script>alert("nope");</script> habitant morbi'),
'Pellentesque tristique senectus' +
' habitant morbi'
' habitant morbi',
);
done();
});
@@ -49,7 +49,7 @@ describe('admin search', function () {
search.sanitize('<p>Pellentesque <b>habitant morbi</b> tristique senectus' +
'Aenean <i>vitae</i> est.Mauris <a href="placerat">eleifend</a> leo.</p>'),
'Pellentesque habitant morbi tristique senectus' +
'Aenean vitae est.Mauris eleifend leo.'
'Aenean vitae est.Mauris eleifend leo.',
);
done();
});
@@ -60,10 +60,10 @@ describe('admin search', function () {
assert.equal(
search.simplify(
'Pellentesque tristique {{senectus}}habitant morbi' +
'liquam tincidunt {mauris.eu}risus'
'liquam tincidunt {mauris.eu}risus',
),
'Pellentesque tristique habitant morbi' +
'liquam tincidunt risus'
'liquam tincidunt risus',
);
done();
});
@@ -71,10 +71,10 @@ describe('admin search', function () {
assert.equal(
search.simplify(
'Pellentesque tristique habitant morbi' +
' \n\n liquam tincidunt mauris eu risus.'
' \n\n liquam tincidunt mauris eu risus.',
),
'Pellentesque tristique habitant morbi' +
'\nliquam tincidunt mauris eu risus.'
'\nliquam tincidunt mauris eu risus.',
);
done();
});

View File

@@ -37,15 +37,15 @@ describe('Search', function () {
category1: function (next) {
categories.create({
name: 'Test Category',
description: 'Test category created by testing script'
description: 'Test category created by testing script',
}, next);
},
category2: function (next) {
categories.create({
name: 'Test Category',
description: 'Test category created by testing script'
description: 'Test category created by testing script',
}, next);
}
},
}, next);
},
function (results, next) {
@@ -61,7 +61,7 @@ describe('Search', function () {
cid: cid1,
title: 'nodebb mongodb bugs',
content: 'avocado cucumber apple orange fox',
tags: ['nodebb', 'bug', 'plugin', 'nodebb-plugin', 'jquery']
tags: ['nodebb', 'bug', 'plugin', 'nodebb-plugin', 'jquery'],
}, next);
},
function (results, next) {
@@ -73,7 +73,7 @@ describe('Search', function () {
cid: cid2,
title: 'java mongodb redis',
content: 'avocado cucumber carrot armadillo',
tags: ['nodebb', 'bug', 'plugin', 'nodebb-plugin', 'javascript']
tags: ['nodebb', 'bug', 'plugin', 'nodebb-plugin', 'javascript'],
}, next);
},
function (results, next) {
@@ -82,15 +82,15 @@ describe('Search', function () {
topics.reply({
uid: phoebeUid,
content: 'reply post apple',
tid: topic2Data.tid
tid: topic2Data.tid,
}, next);
},
function (_post3Data, next) {
post3Data = _post3Data;
setTimeout(next, 500);
}
},
], next);
}
},
], done);
});
@@ -102,7 +102,7 @@ describe('Search', function () {
request({
url: nconf.get('url') + qs,
json: true
json: true,
}, function (err, response, body) {
assert.ifError(err);
assert(body);
@@ -118,7 +118,7 @@ describe('Search', function () {
it('should search for a user', function (done) {
search.search({
query: 'gin',
searchIn: 'users'
searchIn: 'users',
}, function (err, data) {
assert.ifError(err);
assert(data);
@@ -133,7 +133,7 @@ describe('Search', function () {
it('should search for a tag', function (done) {
search.search({
query: 'plug',
searchIn: 'tags'
searchIn: 'tags',
}, function (err, data) {
assert.ifError(err);
assert(data);
@@ -148,7 +148,7 @@ describe('Search', function () {
it('should fail if searchIn is wrong', function (done) {
search.search({
query: 'plug',
searchIn: 'invalidfilter'
searchIn: 'invalidfilter',
}, function (err) {
assert.equal(err.message, '[[error:unknown-search-filter]]');
done();
@@ -159,7 +159,7 @@ describe('Search', function () {
search.search({
query: 'mongodb',
searchIn: 'titles',
hasTags: ['nodebb', 'javascript']
hasTags: ['nodebb', 'javascript'],
}, function (err, data) {
assert.ifError(err);
assert.equal(data.posts[0].tid, topic2Data.tid);

View File

@@ -33,8 +33,8 @@ describe('socket.io', function () {
async.apply(user.create, { username: 'regular', password: 'regularpwd', email: 'regular@test.com'}),
async.apply(categories.create, {
name: 'Test Category',
description: 'Test category created by testing script'
})
description: 'Test category created by testing script',
}),
], function (err, data) {
if (err) {
return done(err);
@@ -52,7 +52,7 @@ describe('socket.io', function () {
request.get({
url: nconf.get('url') + '/api/config',
jar: cookies,
json: true
json: true,
}, function (err, res, body) {
assert.ifError(err);
@@ -60,12 +60,12 @@ describe('socket.io', function () {
jar: cookies,
form: {
username: 'admin',
password: 'adminpwd'
password: 'adminpwd',
},
headers: {
'x-csrf-token': body.csrf_token
'x-csrf-token': body.csrf_token,
},
json: true
json: true,
}, function (err, res, body) {
assert.ifError(err);

View File

@@ -28,7 +28,7 @@ describe('Topic\'s', function () {
categories.create({
name: 'Test Category',
description: 'Test category created by testing script'
description: 'Test category created by testing script',
}, function (err, category) {
if (err) {
return done(err);
@@ -40,7 +40,7 @@ describe('Topic\'s', function () {
userId: uid,
categoryId: categoryObj.cid,
title: 'Test Topic Title',
content: 'The content of test topic'
content: 'The content of test topic',
};
done();
});
@@ -248,7 +248,7 @@ describe('Topic\'s', function () {
function (next) {
categories.create({
name: 'Test Category',
description: 'Test category created by testing script'
description: 'Test category created by testing script',
}, function (err, category) {
if (err) {
return next(err);
@@ -256,7 +256,7 @@ describe('Topic\'s', function () {
moveCid = category.cid;
next();
});
}
},
], done);
});
@@ -370,7 +370,7 @@ describe('Topic\'s', function () {
uid: topic.userId,
title: 'topic for test',
content: 'topic content',
cid: topic.categoryId
cid: topic.categoryId,
}, callback);
}
async.series({
@@ -382,7 +382,7 @@ describe('Topic\'s', function () {
},
topic3: function (next) {
createTopic(next);
}
},
}, function (err, results) {
assert.ifError(err);
tid1 = results.topic1.topicData.tid;
@@ -394,7 +394,7 @@ describe('Topic\'s', function () {
},
function (next) {
topics.tools.pin(tid2, adminUid, next);
}
},
], done);
});
});
@@ -472,7 +472,7 @@ describe('Topic\'s', function () {
},
function (done) {
topics.markUnread( newTid, uid, done );
}
},
],done);
});
@@ -489,7 +489,7 @@ describe('Topic\'s', function () {
var tids = topics.map( function (topic) { return topic.tid; } );
assert.equal(tids.indexOf(newTid), -1, 'The topic appeared in the unread list.');
done();
}
},
], done);
});
@@ -513,7 +513,7 @@ describe('Topic\'s', function () {
}
assert.ok(topic, 'topic didn\'t appear in the recent list');
done();
}
},
], done);
});
@@ -533,7 +533,7 @@ describe('Topic\'s', function () {
var tids = topics.map( function (topic) { return topic.tid; } );
assert.notEqual(tids.indexOf(newTid), -1, 'The topic did not appear in the unread list.');
done();
}
},
], done);
});
@@ -553,7 +553,7 @@ describe('Topic\'s', function () {
var tids = topics.map( function (topic) { return topic.tid; } );
assert.notEqual(tids.indexOf(newTid), -1, 'The topic did not appear in the unread list.');
done();
}
},
], done);
});
});
@@ -569,7 +569,7 @@ describe('Topic\'s', function () {
assert.ok(result);
replies.push(result);
next();
}
},
);
}
@@ -625,7 +625,7 @@ describe('Topic\'s', function () {
function ( bookmark, next ) {
assert.equal( originalBookmark, bookmark );
next();
}
},
],done);
});
@@ -645,7 +645,7 @@ describe('Topic\'s', function () {
function ( bookmark, next ) {
assert.equal( originalBookmark - 2, bookmark );
next();
}
},
],done);
});
});
@@ -656,7 +656,7 @@ describe('Topic\'s', function () {
title: 'topic for controller test',
content: 'topic content',
cid: topic.categoryId,
thumb: 'http://i.imgur.com/64iBdBD.jpg'
thumb: 'http://i.imgur.com/64iBdBD.jpg',
}, function (err, result) {
assert.ifError(err);
assert.ok(result);
@@ -762,7 +762,7 @@ describe('Topic\'s', function () {
},
topic2: function (next) {
topics.post({uid: adminUid, tags: ['nodebb'], title: 'topic title 2', content: 'topic 2 content', cid: topic.categoryId}, next);
}
},
}, function (err, results) {
assert.ifError(err);
tid1 = results.topic1.topicData.tid;
@@ -792,7 +792,7 @@ describe('Topic\'s', function () {
},
user: function (next) {
User.create({username: 'regularJoe'}, next);
}
},
}, function (err, results) {
assert.ifError(err);
tid = results.topic.topicData.tid;
@@ -880,7 +880,7 @@ describe('Topic\'s', function () {
function (count, next) {
assert.equal(count, 0);
next();
}
},
], function (err) {
assert.ifError(err);
done();
@@ -960,7 +960,7 @@ describe('Topic\'s', function () {
},
regularRead: function (next) {
topics.hasReadTopic(tid, uid, next);
}
},
}, function (err, results) {
assert.ifError(err);
assert.equal(results.adminRead, false);
@@ -982,7 +982,7 @@ describe('Topic\'s', function () {
},
topic2: function (next) {
topics.post({uid: adminUid, tags: ['javascript', 'mysql', 'python', 'nodejs'], title: 'topic title 2', content: 'topic 2 content', cid: topic.categoryId}, next);
}
},
}, function (err) {
assert.ifError(err);
done();
@@ -1043,7 +1043,7 @@ describe('Topic\'s', function () {
var tagData = [
{ value: 'nodebb', color: '', bgColor: '', score: 3 },
{ value: 'nodejs', color: '', bgColor: '', score: 1 },
{ value: 'nosql', color: '', bgColor: '', score: 1 }
{ value: 'nosql', color: '', bgColor: '', score: 1 },
];
assert.deepEqual(data.tags, tagData);
@@ -1120,7 +1120,7 @@ describe('Topic\'s', function () {
it('should error if data.tag is invalid', function (done) {
socketAdmin.tags.update({uid: adminUid}, {
bgColor: '#ff0000',
color: '#00ff00'
color: '#00ff00',
}, function (err) {
assert.equal(err.message, '[[error:invalid-tag]]');
done();
@@ -1131,7 +1131,7 @@ describe('Topic\'s', function () {
socketAdmin.tags.update({uid: adminUid}, {
tag: 'emptytag',
bgColor: '#ff0000',
color: '#00ff00'
color: '#00ff00',
}, function (err) {
assert.ifError(err);
db.getObject('tag:emptytag', function (err, data) {
@@ -1147,7 +1147,7 @@ describe('Topic\'s', function () {
var meta = require('../src/meta');
meta.config.maximumRelatedTopics = 2;
var topicData = {
tags: [{value: 'javascript'}]
tags: [{value: 'javascript'}],
};
topics.getRelatedTopics(topicData, 0, function (err, data) {
assert.ifError(err);

View File

@@ -218,7 +218,7 @@ describe('Translator static methods', function () {
it('should remove translator patterns from text', function (done) {
assert.strictEqual(
Translator.removePatterns('Lorem ipsum dolor [[sit:amet]], consectetur adipiscing elit. [[sed:vitae, [[semper:dolor]]]] lorem'),
'Lorem ipsum dolor , consectetur adipiscing elit. lorem'
'Lorem ipsum dolor , consectetur adipiscing elit. lorem',
);
done();
});
@@ -227,7 +227,7 @@ describe('Translator static methods', function () {
it('should escape translation patterns within text', function (done) {
assert.strictEqual(
Translator.escape('some nice text [[global:home]] here'),
'some nice text \\[\\[global:home\\]\\] here'
'some nice text \\[\\[global:home\\]\\] here',
);
done();
});
@@ -237,7 +237,7 @@ describe('Translator static methods', function () {
it('should unescape escaped translation patterns within text', function (done) {
assert.strictEqual(
Translator.unescape('some nice text \\[\\[global:home\\]\\] here'),
'some nice text [[global:home]] here'
'some nice text [[global:home]] here',
);
done();
});
@@ -247,7 +247,7 @@ describe('Translator static methods', function () {
it('should create a translator pattern from a key and list of arguments', function (done) {
assert.strictEqual(
Translator.compile('amazing:cool', 'awesome', 'great'),
'[[amazing:cool, awesome, great]]'
'[[amazing:cool, awesome, great]]',
);
done();
});
@@ -255,7 +255,7 @@ describe('Translator static methods', function () {
it('should escape `%` and `,` in arguments', function (done) {
assert.strictEqual(
Translator.compile('amazing:cool', '100% awesome!', 'one, two, and three'),
'[[amazing:cool, 100&#37; awesome!, one&#44; two&#44; and three]]'
'[[amazing:cool, 100&#37; awesome!, one&#44; two&#44; and three]]',
);
done();
});

View File

@@ -28,7 +28,7 @@ describe('Upload Controllers', function () {
category: function (next) {
categories.create({
name: 'Test Category',
description: 'Test category created by testing script'
description: 'Test category created by testing script',
}, next);
},
adminUid: function (next) {
@@ -36,7 +36,7 @@ describe('Upload Controllers', function () {
},
regularUid: function (next) {
user.create({username: 'regular', password: 'zugzug'}, next);
}
},
}, function (err, results) {
if (err) {
return done(err);

View File

@@ -28,7 +28,7 @@ describe('User', function () {
Categories.create({
name: 'Test Category',
description: 'A test',
order: 1
order: 1,
}, function (err, categoryObj) {
if (err) {
return done(err);
@@ -45,7 +45,7 @@ describe('User', function () {
fullname: 'John Smith McNamara',
password: 'swordfish',
email: 'john@example.com',
callback: undefined
callback: undefined,
};
});
@@ -108,14 +108,14 @@ describe('User', function () {
uid: testUid,
title: 'Topic 1',
content: 'lorem ipsum',
cid: testCid
cid: testCid,
}),
async.apply(Topics.post, {
uid: testUid,
title: 'Topic 2',
content: 'lorem ipsum',
cid: testCid
})
cid: testCid,
}),
], function (err) {
assert(err);
done();
@@ -128,7 +128,7 @@ describe('User', function () {
uid: testUid,
title: 'Topic 3',
content: 'lorem ipsum',
cid: testCid
cid: testCid,
}, function (err) {
assert.ifError(err);
done();
@@ -145,7 +145,7 @@ describe('User', function () {
uid: testUid,
title: 'Topic 4',
content: 'lorem ipsum',
cid: testCid
cid: testCid,
}, function (err) {
assert(err);
done();
@@ -156,13 +156,13 @@ describe('User', function () {
it('should not error if a non-newbie user posts if the last post time is 10 < 30 seconds', function (done) {
User.setUserFields(testUid, {
lastposttime: +new Date() - (20 * 1000),
reputation: 10
reputation: 10,
}, function () {
Topics.post({
uid: testUid,
title: 'Topic 5',
content: 'lorem ipsum',
cid: testCid
cid: testCid,
}, function (err) {
assert.ifError(err);
done();
@@ -380,7 +380,7 @@ describe('User', function () {
location: 'izmir',
groupTitle: 'testGroup',
birthday: '01/01/1980',
signature: 'nodebb is good'
signature: 'nodebb is good',
};
io.emit('user.updateProfile', data, function (err, result) {
assert.ifError(err);
@@ -499,7 +499,7 @@ describe('User', function () {
var picture = {
path: path.join(nconf.get('base_dir'), 'public', 'logo.png'),
size: 7189,
name: 'logo.png'
name: 'logo.png',
};
User.uploadPicture(uid, picture, function (err, uploadedPicture) {
assert.ifError(err);
@@ -515,7 +515,7 @@ describe('User', function () {
var picture = {
path: path.join(nconf.get('base_dir'), 'public', 'logo.png'),
size: 7189,
name: 'logo.png'
name: 'logo.png',
};
User.uploadPicture(uid, picture, function (err, uploadedPicture) {
assert.equal(err.message, '[[error:profile-image-uploads-disabled]]');
@@ -529,7 +529,7 @@ describe('User', function () {
var picture = {
path: path.join(nconf.get('base_dir'), 'public', 'logo.png'),
size: 265000,
name: 'logo.png'
name: 'logo.png',
};
User.uploadPicture(uid, picture, function (err, uploadedPicture) {
assert.equal(err.message, '[[error:file-too-big, 256]]');
@@ -542,7 +542,7 @@ describe('User', function () {
var picture = {
path: path.join(nconf.get('base_dir'), 'public', 'logo.png'),
size: 7189,
name: 'logo'
name: 'logo',
};
User.uploadPicture(uid, picture, function (err, uploadedPicture) {
assert.equal(err.message, '[[error:invalid-image-extension]]');
@@ -672,7 +672,7 @@ describe('User', function () {
it('should load user\'s groups page', function (done) {
groups.create({
name: 'Test',
description: 'Foobar!'
description: 'Foobar!',
}, function (err) {
assert.ifError(err);
groups.join('Test', uid, function (err) {
@@ -707,7 +707,7 @@ describe('User', function () {
next(err);
});
}
},
], function (err) {
assert.ifError(err);
User.unban(testUid, function (err) {
@@ -879,8 +879,8 @@ describe('User', function () {
followTopicsOnReply: 1,
notificationSound: '',
incomingChatSound: '',
outgoingChatSound: ''
}
outgoingChatSound: '',
},
};
socketUser.saveSettings({uid: testUid}, data, function (err) {
assert.ifError(err);
@@ -931,7 +931,7 @@ describe('User', function () {
helpers.registerUser({
username: 'rejectme',
password: '123456',
email: 'reject@me.com'
email: 'reject@me.com',
}, function (err) {
assert.ifError(err);
helpers.loginUser('admin', '123456', function (err, jar) {
@@ -961,7 +961,7 @@ describe('User', function () {
helpers.registerUser({
username: 'acceptme',
password: '123456',
email: 'accept@me.com'
email: 'accept@me.com',
}, function (err) {
assert.ifError(err);
socketAdmin.user.acceptRegistration({uid: adminUid}, {username: 'acceptme'}, function (err, uid) {