diff --git a/src/socket.io/index.js b/src/socket.io/index.js index 00d3433a3d..2e897d0c4c 100644 --- a/src/socket.io/index.js +++ b/src/socket.io/index.js @@ -93,8 +93,7 @@ function onMessage(socket, payload) { var eventName = payload.data[0]; var params = payload.data[1]; - var callback = typeof payload.data[payload.data.length - 1] === 'function' ? payload.data[payload.data.length - 1] : function () { - }; + var callback = typeof payload.data[payload.data.length - 1] === 'function' ? payload.data[payload.data.length - 1] : function () {}; if (!eventName) { return winston.warn('[socket.io] Empty method name'); diff --git a/test/helpers/index.js b/test/helpers/index.js index e1274d5931..29a66e00dd 100644 --- a/test/helpers/index.js +++ b/test/helpers/index.js @@ -92,22 +92,6 @@ helpers.connectSocketIO = function (res, callback) { }); }; -helpers.initSocketIO = function (callback) { - var jar; - request.get({ - url: nconf.get('url') + '/api/config', - jar: jar, - json: true, - }, function (err, res) { - if (err) { - return callback(err); - } - helpers.connectSocketIO(res, function (err, io) { - callback(err, jar, io); - }); - }); -}; - helpers.uploadFile = function (uploadEndPoint, filePath, body, jar, csrf_token, callback) { var formData = { files: [ diff --git a/test/user.js b/test/user.js index 417424a033..93d2f77f6e 100644 --- a/test/user.js +++ b/test/user.js @@ -454,17 +454,8 @@ describe('User', function () { }); describe('not logged in', function () { - var io; - before(function (done) { - helpers.initSocketIO(function (err, _jar, _io) { - assert.ifError(err); - io = _io; - done(); - }); - }); - it('should return error if not logged in', function (done) { - io.emit('user.updateProfile', {}, function (err) { + socketUser.updateProfile({ uid: 0 }, {}, function (err) { assert.equal(err.message, '[[error:invalid-uid]]'); done(); });