test: socket.emit doesnt exist in tests

isekai-main
Barış Soner Uşaklı 3 years ago
parent 1719bff89c
commit 61d1f56500

@ -172,7 +172,9 @@ User.exportUsersCSV = async function (socket) {
setTimeout(async () => {
try {
await user.exportUsersCSV();
socket.emit('event:export-users-csv');
if (socket.emit) {
socket.emit('event:export-users-csv');
}
const notifications = require('../../notifications');
const n = await notifications.create({
bodyShort: '[[notifications:users-csv-exported]]',
@ -182,7 +184,7 @@ User.exportUsersCSV = async function (socket) {
});
await notifications.push(n, [socket.uid]);
} catch (err) {
winston.error(err);
winston.error(err.stack);
}
}, 0);
};

@ -253,7 +253,7 @@ Sockets.getCountInRoom = function (room) {
};
Sockets.warnDeprecated = (socket, replacement) => {
if (socket.previousEvents) {
if (socket.previousEvents && socket.emit) {
socket.emit('event:deprecated_call', {
eventName: socket.previousEvents[socket.previousEvents.length - 1],
replacement: replacement,

Loading…
Cancel
Save