m.id === data.id);
diff --git a/client/js/socket-events/msg_special.js b/client/js/socket-events/msg_special.js
index 52c6ebef..b0d15692 100644
--- a/client/js/socket-events/msg_special.js
+++ b/client/js/socket-events/msg_special.js
@@ -4,7 +4,7 @@ import socket from "../socket";
import store from "../store";
import {switchToChannel} from "../router";
-socket.on("msg:special", function(data) {
+socket.on("msg:special", function (data) {
const channel = store.getters.findChannel(data.chan);
channel.channel.data = data.data;
switchToChannel(channel.channel);
diff --git a/client/js/socket-events/names.js b/client/js/socket-events/names.js
index ac0d1fa0..bfd1c6c4 100644
--- a/client/js/socket-events/names.js
+++ b/client/js/socket-events/names.js
@@ -3,7 +3,7 @@
import socket from "../socket";
import store from "../store";
-socket.on("names", function(data) {
+socket.on("names", function (data) {
const channel = store.getters.findChannel(data.id);
if (channel) {
diff --git a/client/js/socket-events/network.js b/client/js/socket-events/network.js
index 951b3f4e..1646d08a 100644
--- a/client/js/socket-events/network.js
+++ b/client/js/socket-events/network.js
@@ -6,7 +6,7 @@ import socket from "../socket";
import store from "../store";
import {switchToChannel} from "../router";
-socket.on("network", function(data) {
+socket.on("network", function (data) {
const network = data.networks[0];
network.isJoinChannelShown = false;
@@ -19,7 +19,7 @@ socket.on("network", function(data) {
switchToChannel(network.channels[network.channels.length - 1]);
});
-socket.on("network:options", function(data) {
+socket.on("network:options", function (data) {
const network = store.getters.findNetwork(data.network);
if (network) {
@@ -27,7 +27,7 @@ socket.on("network:options", function(data) {
}
});
-socket.on("network:status", function(data) {
+socket.on("network:status", function (data) {
const network = store.getters.findNetwork(data.network);
if (!network) {
@@ -45,7 +45,7 @@ socket.on("network:status", function(data) {
}
});
-socket.on("channel:state", function(data) {
+socket.on("channel:state", function (data) {
const channel = store.getters.findChannel(data.chan);
if (channel) {
@@ -53,7 +53,7 @@ socket.on("channel:state", function(data) {
}
});
-socket.on("network:info", function(data) {
+socket.on("network:info", function (data) {
const network = store.getters.findNetwork(data.uuid);
if (!network) {
diff --git a/client/js/socket-events/nick.js b/client/js/socket-events/nick.js
index 6713b9b8..08211451 100644
--- a/client/js/socket-events/nick.js
+++ b/client/js/socket-events/nick.js
@@ -3,7 +3,7 @@
import socket from "../socket";
import store from "../store";
-socket.on("nick", function(data) {
+socket.on("nick", function (data) {
const network = store.getters.findNetwork(data.network);
if (network) {
diff --git a/client/js/socket-events/open.js b/client/js/socket-events/open.js
index 4bd01058..18bcf24c 100644
--- a/client/js/socket-events/open.js
+++ b/client/js/socket-events/open.js
@@ -4,7 +4,7 @@ import socket from "../socket";
import store from "../store";
// Sync unread badge and marker when other clients open a channel
-socket.on("open", function(id) {
+socket.on("open", function (id) {
if (id < 1) {
return;
}
diff --git a/client/js/socket-events/part.js b/client/js/socket-events/part.js
index c9724a45..58be3a57 100644
--- a/client/js/socket-events/part.js
+++ b/client/js/socket-events/part.js
@@ -4,7 +4,7 @@ import socket from "../socket";
import store from "../store";
import {switchToChannel} from "../router";
-socket.on("part", function(data) {
+socket.on("part", function (data) {
// When parting from the active channel/query, jump to the network's lobby
if (store.state.activeChannel && store.state.activeChannel.channel.id === data.chan) {
switchToChannel(store.state.activeChannel.network.channels[0]);
diff --git a/client/js/socket-events/quit.js b/client/js/socket-events/quit.js
index 31d296b3..ed3da8d4 100644
--- a/client/js/socket-events/quit.js
+++ b/client/js/socket-events/quit.js
@@ -4,7 +4,7 @@ import socket from "../socket";
import {switchToChannel, navigate} from "../router";
import store from "../store";
-socket.on("quit", function(data) {
+socket.on("quit", function (data) {
// If we're in a channel, and it's on the network that is being removed,
// then open another channel window
const isCurrentNetworkBeingRemoved =
diff --git a/client/js/socket-events/sessions_list.js b/client/js/socket-events/sessions_list.js
index 818cfe2b..98cf777f 100644
--- a/client/js/socket-events/sessions_list.js
+++ b/client/js/socket-events/sessions_list.js
@@ -3,7 +3,7 @@
import socket from "../socket";
import store from "../store";
-socket.on("sessions:list", function(data) {
+socket.on("sessions:list", function (data) {
data.sort((a, b) => b.lastUse - a.lastUse);
store.commit("sessions", data);
});
diff --git a/client/js/socket-events/setting.js b/client/js/socket-events/setting.js
index e16e6c31..62ae6735 100644
--- a/client/js/socket-events/setting.js
+++ b/client/js/socket-events/setting.js
@@ -3,13 +3,13 @@
import socket from "../socket";
import store from "../store";
-socket.on("setting:new", function(data) {
+socket.on("setting:new", function (data) {
const name = data.name;
const value = data.value;
store.dispatch("settings/update", {name, value, sync: false});
});
-socket.on("setting:all", function(settings) {
+socket.on("setting:all", function (settings) {
const serverHasSettings = Object.keys(settings).length > 0;
store.commit("serverHasSettings", serverHasSettings);
diff --git a/client/js/socket-events/sign_out.js b/client/js/socket-events/sign_out.js
index d5f0e43f..be37cef4 100644
--- a/client/js/socket-events/sign_out.js
+++ b/client/js/socket-events/sign_out.js
@@ -3,6 +3,6 @@
import socket from "../socket";
import Auth from "../auth";
-socket.on("sign-out", function() {
+socket.on("sign-out", function () {
Auth.signout();
});
diff --git a/client/js/socket-events/sync_sort.js b/client/js/socket-events/sync_sort.js
index b2661ee8..abb0a256 100644
--- a/client/js/socket-events/sync_sort.js
+++ b/client/js/socket-events/sync_sort.js
@@ -3,7 +3,7 @@
import socket from "../socket";
import store from "../store";
-socket.on("sync_sort", function(data) {
+socket.on("sync_sort", function (data) {
const order = data.order;
switch (data.type) {
diff --git a/client/js/socket-events/topic.js b/client/js/socket-events/topic.js
index a9ab5c8a..f14dcee5 100644
--- a/client/js/socket-events/topic.js
+++ b/client/js/socket-events/topic.js
@@ -3,7 +3,7 @@
import socket from "../socket";
import store from "../store";
-socket.on("topic", function(data) {
+socket.on("topic", function (data) {
const channel = store.getters.findChannel(data.chan);
if (channel) {
diff --git a/client/js/socket-events/users.js b/client/js/socket-events/users.js
index 95fa49a4..3d040f1f 100644
--- a/client/js/socket-events/users.js
+++ b/client/js/socket-events/users.js
@@ -3,7 +3,7 @@
import socket from "../socket";
import store from "../store";
-socket.on("users", function(data) {
+socket.on("users", function (data) {
if (store.state.activeChannel && store.state.activeChannel.channel.id === data.chan) {
return socket.emit("names", {
target: data.chan,
diff --git a/client/js/vue.js b/client/js/vue.js
index c23f5567..3467b3c4 100644
--- a/client/js/vue.js
+++ b/client/js/vue.js
@@ -103,7 +103,7 @@ store.watch(
}
);
-Vue.config.errorHandler = function(e) {
+Vue.config.errorHandler = function (e) {
store.commit("currentUserVisibleError", `Vue error: ${e.message}`);
console.error(e); // eslint-disable-line
};
diff --git a/client/js/webpush.js b/client/js/webpush.js
index 0c0cbcc4..efc72a8a 100644
--- a/client/js/webpush.js
+++ b/client/js/webpush.js
@@ -5,7 +5,7 @@ import store from "./store";
export default {togglePushSubscription};
-socket.once("push:issubscribed", function(hasSubscriptionOnServer) {
+socket.once("push:issubscribed", function (hasSubscriptionOnServer) {
if (!isAllowedServiceWorkersHost()) {
store.commit("pushNotificationState", "nohttps");
return;
diff --git a/client/service-worker.js b/client/service-worker.js
index 4596d5da..eea74070 100644
--- a/client/service-worker.js
+++ b/client/service-worker.js
@@ -5,11 +5,11 @@
const cacheName = "__HASH__";
const excludedPathsFromCache = /^(?:socket\.io|storage|uploads|cdn-cgi)\//;
-self.addEventListener("install", function() {
+self.addEventListener("install", function () {
self.skipWaiting();
});
-self.addEventListener("activate", function(event) {
+self.addEventListener("activate", function (event) {
event.waitUntil(
caches
.keys()
@@ -23,7 +23,7 @@ self.addEventListener("activate", function(event) {
event.waitUntil(self.clients.claim());
});
-self.addEventListener("fetch", function(event) {
+self.addEventListener("fetch", function (event) {
if (event.request.method !== "GET") {
return;
}
@@ -108,11 +108,11 @@ async function networkOrCache(event) {
}
}
-self.addEventListener("message", function(event) {
+self.addEventListener("message", function (event) {
showNotification(event, event.data);
});
-self.addEventListener("push", function(event) {
+self.addEventListener("push", function (event) {
if (!event.data) {
return;
}
@@ -147,7 +147,7 @@ function showNotification(event, payload) {
);
}
-self.addEventListener("notificationclick", function(event) {
+self.addEventListener("notificationclick", function (event) {
event.notification.close();
event.waitUntil(
diff --git a/scripts/changelog.js b/scripts/changelog.js
index d4e847a3..55c48c24 100644
--- a/scripts/changelog.js
+++ b/scripts/changelog.js
@@ -66,10 +66,7 @@ const changelogPath = path.resolve(__dirname, "..", "CHANGELOG.md");
if (token === undefined) {
try {
- token = fs
- .readFileSync(path.resolve(__dirname, "./github_token.txt"))
- .toString()
- .trim();
+ token = fs.readFileSync(path.resolve(__dirname, "./github_token.txt")).toString().trim();
} catch (e) {
log.error(`Environment variable ${colors.bold("CHANGELOG_TOKEN")} must be set.`);
log.error(`Alternative create ${colors.bold("scripts/github_token.txt")} file.`);
diff --git a/scripts/generate-config-doc.js b/scripts/generate-config-doc.js
index 2841484a..882f2172 100644
--- a/scripts/generate-config-doc.js
+++ b/scripts/generate-config-doc.js
@@ -63,8 +63,5 @@ log.info(
);
function getPrettyDate() {
- return new Date()
- .toISOString()
- .split(".")[0]
- .replace("T", " ");
+ return new Date().toISOString().split(".")[0].replace("T", " ");
}
diff --git a/scripts/noop.js b/scripts/noop.js
index bf1c83cb..b9a29cec 100644
--- a/scripts/noop.js
+++ b/scripts/noop.js
@@ -1,5 +1,5 @@
"use strict";
-module.exports = function() {
- return function() {};
+module.exports = function () {
+ return function () {};
};
diff --git a/src/client.js b/src/client.js
index 637f864d..9ee23b4d 100644
--- a/src/client.js
+++ b/src/client.js
@@ -138,20 +138,20 @@ function Client(manager, name, config = {}) {
}
}
-Client.prototype.createChannel = function(attr) {
+Client.prototype.createChannel = function (attr) {
const chan = new Chan(attr);
chan.id = this.idChan++;
return chan;
};
-Client.prototype.emit = function(event, data) {
+Client.prototype.emit = function (event, data) {
if (this.manager !== null) {
this.manager.sockets.in(this.id).emit(event, data);
}
};
-Client.prototype.find = function(channelId) {
+Client.prototype.find = function (channelId) {
let network = null;
let chan = null;
@@ -172,7 +172,7 @@ Client.prototype.find = function(channelId) {
return false;
};
-Client.prototype.connect = function(args, isStartup = false) {
+Client.prototype.connect = function (args, isStartup = false) {
const client = this;
let channels = [];
@@ -279,7 +279,7 @@ Client.prototype.connect = function(args, isStartup = false) {
}
};
-Client.prototype.generateToken = function(callback) {
+Client.prototype.generateToken = function (callback) {
crypto.randomBytes(64, (err, buf) => {
if (err) {
throw err;
@@ -289,14 +289,11 @@ Client.prototype.generateToken = function(callback) {
});
};
-Client.prototype.calculateTokenHash = function(token) {
- return crypto
- .createHash("sha512")
- .update(token)
- .digest("hex");
+Client.prototype.calculateTokenHash = function (token) {
+ return crypto.createHash("sha512").update(token).digest("hex");
};
-Client.prototype.updateSession = function(token, ip, request) {
+Client.prototype.updateSession = function (token, ip, request) {
const client = this;
const agent = UAParser(request.headers["user-agent"] || "");
let friendlyAgent = "";
@@ -324,12 +321,12 @@ Client.prototype.updateSession = function(token, ip, request) {
client.save();
};
-Client.prototype.setPassword = function(hash, callback) {
+Client.prototype.setPassword = function (hash, callback) {
const client = this;
const oldHash = client.config.password;
client.config.password = hash;
- client.manager.saveUser(client, function(err) {
+ client.manager.saveUser(client, function (err) {
if (err) {
// If user file fails to write, reset it back
client.config.password = oldHash;
@@ -340,7 +337,7 @@ Client.prototype.setPassword = function(hash, callback) {
});
};
-Client.prototype.input = function(data) {
+Client.prototype.input = function (data) {
const client = this;
data.text.split("\n").forEach((line) => {
data.text = line;
@@ -348,7 +345,7 @@ Client.prototype.input = function(data) {
});
};
-Client.prototype.inputLine = function(data) {
+Client.prototype.inputLine = function (data) {
const client = this;
const target = client.find(data.target);
@@ -420,7 +417,7 @@ Client.prototype.inputLine = function(data) {
}
};
-Client.prototype.compileCustomHighlights = function() {
+Client.prototype.compileCustomHighlights = function () {
const client = this;
if (typeof client.config.clientSettings.highlights !== "string") {
@@ -446,7 +443,7 @@ Client.prototype.compileCustomHighlights = function() {
);
};
-Client.prototype.more = function(data) {
+Client.prototype.more = function (data) {
const client = this;
const target = client.find(data.target);
@@ -501,7 +498,7 @@ Client.prototype.more = function(data) {
};
};
-Client.prototype.clearHistory = function(data) {
+Client.prototype.clearHistory = function (data) {
const client = this;
const target = client.find(data.target);
@@ -527,7 +524,7 @@ Client.prototype.clearHistory = function(data) {
}
};
-Client.prototype.open = function(socketId, target) {
+Client.prototype.open = function (socketId, target) {
// Due to how socket.io works internally, normal events may arrive later than
// the disconnect event, and because we can't control this timing precisely,
// process this event normally even if there is no attached client anymore.
@@ -558,7 +555,7 @@ Client.prototype.open = function(socketId, target) {
this.emit("open", target.chan.id);
};
-Client.prototype.sort = function(data) {
+Client.prototype.sort = function (data) {
const order = data.order;
if (!_.isArray(order)) {
@@ -610,7 +607,7 @@ Client.prototype.sort = function(data) {
this.save();
};
-Client.prototype.names = function(data) {
+Client.prototype.names = function (data) {
const client = this;
const target = client.find(data.target);
@@ -624,7 +621,7 @@ Client.prototype.names = function(data) {
});
};
-Client.prototype.quit = function(signOut) {
+Client.prototype.quit = function (signOut) {
const sockets = this.manager.sockets.sockets;
const room = sockets.adapter.rooms[this.id];
@@ -652,11 +649,11 @@ Client.prototype.quit = function(signOut) {
}
};
-Client.prototype.clientAttach = function(socketId, token) {
+Client.prototype.clientAttach = function (socketId, token) {
const client = this;
if (client.awayMessage && _.size(client.attachedClients) === 0) {
- client.networks.forEach(function(network) {
+ client.networks.forEach(function (network) {
// Only remove away on client attachment if
// there is no away message on this network
if (network.irc && !network.awayMessage) {
@@ -669,13 +666,13 @@ Client.prototype.clientAttach = function(socketId, token) {
client.attachedClients[socketId] = {token, openChannel};
};
-Client.prototype.clientDetach = function(socketId) {
+Client.prototype.clientDetach = function (socketId) {
const client = this;
delete this.attachedClients[socketId];
if (client.awayMessage && _.size(client.attachedClients) === 0) {
- client.networks.forEach(function(network) {
+ client.networks.forEach(function (network) {
// Only set away on client deattachment if
// there is no away message on this network
if (network.irc && !network.awayMessage) {
@@ -685,7 +682,7 @@ Client.prototype.clientDetach = function(socketId) {
}
};
-Client.prototype.registerPushSubscription = function(session, subscription, noSave) {
+Client.prototype.registerPushSubscription = function (session, subscription, noSave) {
if (
!_.isPlainObject(subscription) ||
!_.isPlainObject(subscription.keys) ||
@@ -715,7 +712,7 @@ Client.prototype.registerPushSubscription = function(session, subscription, noSa
return data;
};
-Client.prototype.unregisterPushSubscription = function(token) {
+Client.prototype.unregisterPushSubscription = function (token) {
this.config.sessions[token].pushSubscription = null;
this.save();
};
diff --git a/src/clientManager.js b/src/clientManager.js
index df774451..7aa8315d 100644
--- a/src/clientManager.js
+++ b/src/clientManager.js
@@ -16,7 +16,7 @@ function ClientManager() {
this.clients = [];
}
-ClientManager.prototype.init = function(identHandler, sockets) {
+ClientManager.prototype.init = function (identHandler, sockets) {
this.sockets = sockets;
this.identHandler = identHandler;
this.webPush = new WebPush();
@@ -32,11 +32,11 @@ ClientManager.prototype.init = function(identHandler, sockets) {
}
};
-ClientManager.prototype.findClient = function(name) {
+ClientManager.prototype.findClient = function (name) {
return this.clients.find((u) => u.name === name);
};
-ClientManager.prototype.loadUsers = function() {
+ClientManager.prototype.loadUsers = function () {
const users = this.getUsers();
if (users.length === 0) {
@@ -48,7 +48,7 @@ ClientManager.prototype.loadUsers = function() {
users.forEach((name) => this.loadUser(name));
};
-ClientManager.prototype.autoloadUsers = function() {
+ClientManager.prototype.autoloadUsers = function () {
fs.watch(
Helper.getUsersPath(),
_.debounce(
@@ -84,7 +84,7 @@ ClientManager.prototype.autoloadUsers = function() {
);
};
-ClientManager.prototype.loadUser = function(name) {
+ClientManager.prototype.loadUser = function (name) {
const userConfig = readUserConfig(name);
if (!userConfig) {
@@ -113,14 +113,14 @@ ClientManager.prototype.loadUser = function(name) {
return client;
};
-ClientManager.prototype.getUsers = function() {
+ClientManager.prototype.getUsers = function () {
return fs
.readdirSync(Helper.getUsersPath())
.filter((file) => file.endsWith(".json"))
.map((file) => file.slice(0, -5));
};
-ClientManager.prototype.addUser = function(name, password, enableLog) {
+ClientManager.prototype.addUser = function (name, password, enableLog) {
if (path.basename(name) !== name) {
throw new Error(`${name} is an invalid username.`);
}
@@ -176,20 +176,17 @@ ClientManager.prototype.addUser = function(name, password, enableLog) {
return true;
};
-ClientManager.prototype.getDataToSave = function(client) {
+ClientManager.prototype.getDataToSave = function (client) {
const json = Object.assign({}, client.config, {
networks: client.networks.map((n) => n.export()),
});
const newUser = JSON.stringify(json, null, "\t");
- const newHash = crypto
- .createHash("sha256")
- .update(newUser)
- .digest("hex");
+ const newHash = crypto.createHash("sha256").update(newUser).digest("hex");
return {newUser, newHash};
};
-ClientManager.prototype.saveUser = function(client, callback) {
+ClientManager.prototype.saveUser = function (client, callback) {
const {newUser, newHash} = this.getDataToSave(client);
// Do not write to disk if the exported data hasn't actually changed
@@ -216,7 +213,7 @@ ClientManager.prototype.saveUser = function(client, callback) {
}
};
-ClientManager.prototype.removeUser = function(name) {
+ClientManager.prototype.removeUser = function (name) {
const userPath = Helper.getUserConfigPath(name);
if (!fs.existsSync(userPath)) {
diff --git a/src/command-line/install.js b/src/command-line/install.js
index 2d7dc704..18ccbb61 100644
--- a/src/command-line/install.js
+++ b/src/command-line/install.js
@@ -10,7 +10,7 @@ program
.command("install
")
.description("Install a theme or a package")
.on("--help", Utils.extraHelp)
- .action(function(packageName) {
+ .action(function (packageName) {
const fs = require("fs");
const packageJson = require("package-json");
diff --git a/src/command-line/start.js b/src/command-line/start.js
index c76e1722..9aa3206a 100644
--- a/src/command-line/start.js
+++ b/src/command-line/start.js
@@ -14,7 +14,7 @@ program
.description("Start the server")
.option("--dev", "Development mode with hot module reloading")
.on("--help", Utils.extraHelp)
- .action(function(options) {
+ .action(function (options) {
initalizeConfig();
const server = require("../server");
diff --git a/src/command-line/uninstall.js b/src/command-line/uninstall.js
index 57f65f4a..8686e668 100644
--- a/src/command-line/uninstall.js
+++ b/src/command-line/uninstall.js
@@ -10,7 +10,7 @@ program
.command("uninstall ")
.description("Uninstall a theme or a package")
.on("--help", Utils.extraHelp)
- .action(function(packageName) {
+ .action(function (packageName) {
const fs = require("fs");
const path = require("path");
diff --git a/src/command-line/upgrade.js b/src/command-line/upgrade.js
index c99538a4..6911ad72 100644
--- a/src/command-line/upgrade.js
+++ b/src/command-line/upgrade.js
@@ -10,7 +10,7 @@ program
.command("upgrade [packages...]")
.description("Upgrade installed themes and packages to their latest versions")
.on("--help", Utils.extraHelp)
- .action(function(packages) {
+ .action(function (packages) {
const fs = require("fs");
const path = require("path");
diff --git a/src/command-line/users/add.js b/src/command-line/users/add.js
index b67136e6..f1975d98 100644
--- a/src/command-line/users/add.js
+++ b/src/command-line/users/add.js
@@ -11,7 +11,7 @@ program
.command("add ")
.description("Add a new user")
.on("--help", Utils.extraHelp)
- .action(function(name) {
+ .action(function (name) {
if (!fs.existsSync(Helper.getUsersPath())) {
log.error(`${Helper.getUsersPath()} does not exist.`);
return;
@@ -36,7 +36,7 @@ program
text: "Enter password:",
silent: true,
},
- function(err, password) {
+ function (err, password) {
if (!password) {
log.error("Password cannot be empty.");
return;
@@ -48,7 +48,7 @@ program
text: "Save logs to disk?",
default: "yes",
},
- function(err2, enableLog) {
+ function (err2, enableLog) {
if (!err2) {
add(
manager,
diff --git a/src/command-line/users/edit.js b/src/command-line/users/edit.js
index 6e659e84..fc28f35d 100644
--- a/src/command-line/users/edit.js
+++ b/src/command-line/users/edit.js
@@ -12,7 +12,7 @@ program
.command("edit ")
.description(`Edit user file located at ${colors.green(Helper.getUserConfigPath(""))}`)
.on("--help", Utils.extraHelp)
- .action(function(name) {
+ .action(function (name) {
if (!fs.existsSync(Helper.getUsersPath())) {
log.error(`${Helper.getUsersPath()} does not exist.`);
return;
@@ -36,7 +36,7 @@ program
[Helper.getUserConfigPath(name)],
{stdio: "inherit"}
);
- child_spawn.on("error", function() {
+ child_spawn.on("error", function () {
log.error(
`Unable to open ${colors.green(Helper.getUserConfigPath(name))}. ${colors.bold(
"$EDITOR"
diff --git a/src/command-line/users/list.js b/src/command-line/users/list.js
index 3577144a..bc8aa44e 100644
--- a/src/command-line/users/list.js
+++ b/src/command-line/users/list.js
@@ -11,7 +11,7 @@ program
.command("list")
.description("List all users")
.on("--help", Utils.extraHelp)
- .action(function() {
+ .action(function () {
if (!fs.existsSync(Helper.getUsersPath())) {
log.error(`${Helper.getUsersPath()} does not exist.`);
return;
diff --git a/src/command-line/users/remove.js b/src/command-line/users/remove.js
index b96b62a8..4b47c407 100644
--- a/src/command-line/users/remove.js
+++ b/src/command-line/users/remove.js
@@ -11,7 +11,7 @@ program
.command("remove ")
.description("Remove an existing user")
.on("--help", Utils.extraHelp)
- .action(function(name) {
+ .action(function (name) {
if (!fs.existsSync(Helper.getUsersPath())) {
log.error(`${Helper.getUsersPath()} does not exist.`);
return;
diff --git a/src/command-line/users/reset.js b/src/command-line/users/reset.js
index ddb550fb..a5f57dc3 100644
--- a/src/command-line/users/reset.js
+++ b/src/command-line/users/reset.js
@@ -11,7 +11,7 @@ program
.command("reset ")
.description("Reset user password")
.on("--help", Utils.extraHelp)
- .action(function(name) {
+ .action(function (name) {
if (!fs.existsSync(Helper.getUsersPath())) {
log.error(`${Helper.getUsersPath()} does not exist.`);
return;
@@ -39,7 +39,7 @@ program
text: "Enter new password:",
silent: true,
},
- function(err, password) {
+ function (err, password) {
if (err) {
return;
}
diff --git a/src/helper.js b/src/helper.js
index 14d2257c..d68bdef8 100644
--- a/src/helper.js
+++ b/src/helper.js
@@ -87,10 +87,7 @@ function getGitCommit() {
}
function getVersionCacheBust() {
- const hash = crypto
- .createHash("sha256")
- .update(Helper.getVersion())
- .digest("hex");
+ const hash = crypto.createHash("sha256").update(Helper.getVersion()).digest("hex");
return hash.substring(0, 10);
}
@@ -208,7 +205,7 @@ function ip2hex(address) {
return address
.split(".")
- .map(function(octet) {
+ .map(function (octet) {
let hex = parseInt(octet, 10).toString(16);
if (hex.length === 1) {
diff --git a/src/identification.js b/src/identification.js
index ff88d4f1..2271013d 100644
--- a/src/identification.js
+++ b/src/identification.js
@@ -109,7 +109,7 @@ class Identification {
` { reply "${connection.user}" }\n`;
});
- fs.writeFile(this.oidentdFile, file, {flag: "w+"}, function(err) {
+ fs.writeFile(this.oidentdFile, file, {flag: "w+"}, function (err) {
if (err) {
log.error("Failed to update oidentd file!", err);
}
diff --git a/src/log.js b/src/log.js
index 8ed220c6..eaf7f48e 100644
--- a/src/log.js
+++ b/src/log.js
@@ -4,10 +4,7 @@ const colors = require("chalk");
const read = require("read");
function timestamp() {
- const datetime = new Date()
- .toISOString()
- .split(".")[0]
- .replace("T", " ");
+ const datetime = new Date().toISOString().split(".")[0].replace("T", " ");
return colors.dim(datetime);
}
diff --git a/src/models/chan.js b/src/models/chan.js
index f324fb4b..b0a4fffd 100644
--- a/src/models/chan.js
+++ b/src/models/chan.js
@@ -44,11 +44,11 @@ function Chan(attr) {
});
}
-Chan.prototype.destroy = function() {
+Chan.prototype.destroy = function () {
this.dereferencePreviews(this.messages);
};
-Chan.prototype.pushMessage = function(client, msg, increasesUnread) {
+Chan.prototype.pushMessage = function (client, msg, increasesUnread) {
const chan = this.id;
const obj = {chan, msg};
@@ -102,7 +102,7 @@ Chan.prototype.pushMessage = function(client, msg, increasesUnread) {
}
};
-Chan.prototype.dereferencePreviews = function(messages) {
+Chan.prototype.dereferencePreviews = function (messages) {
if (!Helper.config.prefetch || !Helper.config.prefetchStorage) {
return;
}
@@ -119,7 +119,7 @@ Chan.prototype.dereferencePreviews = function(messages) {
});
};
-Chan.prototype.getSortedUsers = function(irc) {
+Chan.prototype.getSortedUsers = function (irc) {
const users = Array.from(this.users.values());
if (!irc || !irc.network || !irc.network.options || !irc.network.options.PREFIX) {
@@ -133,7 +133,7 @@ Chan.prototype.getSortedUsers = function(irc) {
userModeSortPriority[""] = 99; // No mode is lowest
- return users.sort(function(a, b) {
+ return users.sort(function (a, b) {
if (a.mode === b.mode) {
return a.nick.toLowerCase() < b.nick.toLowerCase() ? -1 : 1;
}
@@ -142,23 +142,23 @@ Chan.prototype.getSortedUsers = function(irc) {
});
};
-Chan.prototype.findMessage = function(msgId) {
+Chan.prototype.findMessage = function (msgId) {
return this.messages.find((message) => message.id === msgId);
};
-Chan.prototype.findUser = function(nick) {
+Chan.prototype.findUser = function (nick) {
return this.users.get(nick.toLowerCase());
};
-Chan.prototype.getUser = function(nick) {
+Chan.prototype.getUser = function (nick) {
return this.findUser(nick) || new User({nick});
};
-Chan.prototype.setUser = function(user) {
+Chan.prototype.setUser = function (user) {
this.users.set(user.nick.toLowerCase(), user);
};
-Chan.prototype.removeUser = function(user) {
+Chan.prototype.removeUser = function (user) {
this.users.delete(user.nick.toLowerCase());
};
@@ -171,7 +171,7 @@ Chan.prototype.removeUser = function(user) {
* If true, channel is assumed active.
* @param {int} lastMessage - Last message id seen by active client to avoid sending duplicates.
*/
-Chan.prototype.getFilteredClone = function(lastActiveChannel, lastMessage) {
+Chan.prototype.getFilteredClone = function (lastActiveChannel, lastMessage) {
return Object.keys(this).reduce((newChannel, prop) => {
if (prop === "users") {
// Do not send users, client requests updated user list whenever needed
@@ -200,7 +200,7 @@ Chan.prototype.getFilteredClone = function(lastActiveChannel, lastMessage) {
}, {});
};
-Chan.prototype.writeUserLog = function(client, msg) {
+Chan.prototype.writeUserLog = function (client, msg) {
this.messages.push(msg);
// Are there any logs enabled
@@ -235,7 +235,7 @@ Chan.prototype.writeUserLog = function(client, msg) {
}
};
-Chan.prototype.loadMessages = function(client, network) {
+Chan.prototype.loadMessages = function (client, network) {
if (!this.isLoggable()) {
return;
}
@@ -278,7 +278,7 @@ Chan.prototype.loadMessages = function(client, network) {
.catch((err) => log.error(`Failed to load messages: ${err}`));
};
-Chan.prototype.isLoggable = function() {
+Chan.prototype.isLoggable = function () {
return this.type === Chan.Type.CHANNEL || this.type === Chan.Type.QUERY;
};
diff --git a/src/models/network.js b/src/models/network.js
index 4b5ea7fd..06594610 100644
--- a/src/models/network.js
+++ b/src/models/network.js
@@ -62,7 +62,7 @@ function Network(attr) {
);
}
-Network.prototype.validate = function(client) {
+Network.prototype.validate = function (client) {
// Remove !, :, @ and whitespace characters from nicknames and usernames
const cleanNick = (str) => str.replace(/[\x00\s:!@]/g, "_").substring(0, 100);
@@ -145,7 +145,7 @@ Network.prototype.validate = function(client) {
return true;
};
-Network.prototype.createIrcFramework = function(client) {
+Network.prototype.createIrcFramework = function (client) {
this.irc = new IrcFramework.Client({
version: false, // We handle it ourselves
host: this.host,
@@ -177,7 +177,7 @@ Network.prototype.createIrcFramework = function(client) {
}
};
-Network.prototype.createWebIrc = function(client) {
+Network.prototype.createWebIrc = function (client) {
if (
!Helper.config.webirc ||
!Object.prototype.hasOwnProperty.call(Helper.config.webirc, this.host)
@@ -207,7 +207,7 @@ Network.prototype.createWebIrc = function(client) {
return webircObject;
};
-Network.prototype.edit = function(client, args) {
+Network.prototype.edit = function (client, args) {
const oldNick = this.nick;
const oldRealname = this.realname;
@@ -276,11 +276,11 @@ Network.prototype.edit = function(client, args) {
client.save();
};
-Network.prototype.destroy = function() {
+Network.prototype.destroy = function () {
this.channels.forEach((channel) => channel.destroy());
};
-Network.prototype.setNick = function(nick) {
+Network.prototype.setNick = function (nick) {
this.nick = nick;
this.highlightRegex = new RegExp(
// Do not match characters and numbers (unless IRC color)
@@ -308,7 +308,7 @@ Network.prototype.setNick = function(nick) {
*
* @see {@link Chan#getFilteredClone}
*/
-Network.prototype.getFilteredClone = function(lastActiveChannel, lastMessage) {
+Network.prototype.getFilteredClone = function (lastActiveChannel, lastMessage) {
const filteredNetwork = Object.keys(this).reduce((newNetwork, prop) => {
if (prop === "channels") {
// Channels objects perform their own cloning
@@ -328,7 +328,7 @@ Network.prototype.getFilteredClone = function(lastActiveChannel, lastMessage) {
return filteredNetwork;
};
-Network.prototype.getNetworkStatus = function() {
+Network.prototype.getNetworkStatus = function () {
const status = {
connected: false,
secure: false,
@@ -349,7 +349,7 @@ Network.prototype.getNetworkStatus = function() {
return status;
};
-Network.prototype.addChannel = function(newChan) {
+Network.prototype.addChannel = function (newChan) {
let index = this.channels.length; // Default to putting as the last item in the array
// Don't sort special channels in amongst channels/users.
@@ -373,7 +373,7 @@ Network.prototype.addChannel = function(newChan) {
return index;
};
-Network.prototype.quit = function(quitMessage) {
+Network.prototype.quit = function (quitMessage) {
if (!this.irc) {
return;
}
@@ -384,7 +384,7 @@ Network.prototype.quit = function(quitMessage) {
this.irc.quit(quitMessage || Helper.config.leaveMessage);
};
-Network.prototype.exportForEdit = function() {
+Network.prototype.exportForEdit = function () {
let fieldsToReturn;
if (Helper.config.displayNetwork) {
@@ -414,7 +414,7 @@ Network.prototype.exportForEdit = function() {
return data;
};
-Network.prototype.export = function() {
+Network.prototype.export = function () {
const network = _.pick(this, [
"uuid",
"awayMessage",
@@ -433,10 +433,10 @@ Network.prototype.export = function() {
]);
network.channels = this.channels
- .filter(function(channel) {
+ .filter(function (channel) {
return channel.type === Chan.Type.CHANNEL || channel.type === Chan.Type.QUERY;
})
- .map(function(chan) {
+ .map(function (chan) {
const keys = ["name"];
if (chan.type === Chan.Type.CHANNEL) {
@@ -451,10 +451,10 @@ Network.prototype.export = function() {
return network;
};
-Network.prototype.getChannel = function(name) {
+Network.prototype.getChannel = function (name) {
name = name.toLowerCase();
- return _.find(this.channels, function(that, i) {
+ return _.find(this.channels, function (that, i) {
// Skip network lobby (it's always unshifted into first position)
return i > 0 && that.name.toLowerCase() === name;
});
diff --git a/src/models/user.js b/src/models/user.js
index 26cdf8f2..a0a63b45 100644
--- a/src/models/user.js
+++ b/src/models/user.js
@@ -16,14 +16,14 @@ function User(attr, prefixLookup) {
this.setModes(this.modes, prefixLookup);
}
-User.prototype.setModes = function(modes, prefixLookup) {
+User.prototype.setModes = function (modes, prefixLookup) {
// irc-framework sets character mode, but The Lounge works with symbols
this.modes = modes.map((mode) => prefixLookup[mode]);
this.mode = this.modes[0] || "";
};
-User.prototype.toJSON = function() {
+User.prototype.toJSON = function () {
return {
nick: this.nick,
mode: this.mode,
diff --git a/src/plugins/auth/ldap.js b/src/plugins/auth/ldap.js
index dc0e4d84..18441e5e 100644
--- a/src/plugins/auth/ldap.js
+++ b/src/plugins/auth/ldap.js
@@ -12,12 +12,12 @@ function ldapAuthCommon(user, bindDN, password, callback) {
tlsOptions: config.ldap.tlsOptions,
});
- ldapclient.on("error", function(err) {
+ ldapclient.on("error", function (err) {
log.error(`Unable to connect to LDAP server: ${err}`);
callback(false);
});
- ldapclient.bind(bindDN, password, function(err) {
+ ldapclient.bind(bindDN, password, function (err) {
ldapclient.unbind();
if (err) {
@@ -67,25 +67,25 @@ function advancedLdapAuth(user, password, callback) {
attributes: ["dn"],
};
- ldapclient.on("error", function(err) {
+ ldapclient.on("error", function (err) {
log.error(`Unable to connect to LDAP server: ${err}`);
callback(false);
});
- ldapclient.bind(config.ldap.searchDN.rootDN, config.ldap.searchDN.rootPassword, function(err) {
+ ldapclient.bind(config.ldap.searchDN.rootDN, config.ldap.searchDN.rootPassword, function (err) {
if (err) {
log.error("Invalid LDAP root credentials");
ldapclient.unbind();
callback(false);
} else {
- ldapclient.search(base, searchOptions, function(err2, res) {
+ ldapclient.search(base, searchOptions, function (err2, res) {
if (err2) {
log.warn(`LDAP User not found: ${userDN}`);
ldapclient.unbind();
callback(false);
} else {
let found = false;
- res.on("searchEntry", function(entry) {
+ res.on("searchEntry", function (entry) {
found = true;
const bindDN = entry.objectName;
log.info(
@@ -95,11 +95,11 @@ function advancedLdapAuth(user, password, callback) {
ldapAuthCommon(user, bindDN, password, callback);
});
- res.on("error", function(err3) {
+ res.on("error", function (err3) {
log.error(`LDAP error: ${err3}`);
callback(false);
});
- res.on("end", function(result) {
+ res.on("end", function (result) {
ldapclient.unbind();
if (!found) {
diff --git a/src/plugins/inputs/action.js b/src/plugins/inputs/action.js
index b1f2e510..8e03b761 100644
--- a/src/plugins/inputs/action.js
+++ b/src/plugins/inputs/action.js
@@ -5,7 +5,7 @@ const Msg = require("../../models/msg");
exports.commands = ["slap", "me"];
-exports.input = function({irc}, chan, cmd, args) {
+exports.input = function ({irc}, chan, cmd, args) {
if (chan.type !== Chan.Type.CHANNEL && chan.type !== Chan.Type.QUERY) {
chan.pushMessage(
this,
diff --git a/src/plugins/inputs/away.js b/src/plugins/inputs/away.js
index a8440bd3..acafdc49 100644
--- a/src/plugins/inputs/away.js
+++ b/src/plugins/inputs/away.js
@@ -2,7 +2,7 @@
exports.commands = ["away", "back"];
-exports.input = function(network, chan, cmd, args) {
+exports.input = function (network, chan, cmd, args) {
let reason = "";
if (cmd === "away") {
diff --git a/src/plugins/inputs/ban.js b/src/plugins/inputs/ban.js
index 1f28302d..9cb66cee 100644
--- a/src/plugins/inputs/ban.js
+++ b/src/plugins/inputs/ban.js
@@ -5,7 +5,7 @@ const Msg = require("../../models/msg");
exports.commands = ["ban", "unban", "banlist"];
-exports.input = function({irc}, chan, cmd, args) {
+exports.input = function ({irc}, chan, cmd, args) {
if (chan.type !== Chan.Type.CHANNEL) {
chan.pushMessage(
this,
diff --git a/src/plugins/inputs/connect.js b/src/plugins/inputs/connect.js
index a8036343..da98f5c0 100644
--- a/src/plugins/inputs/connect.js
+++ b/src/plugins/inputs/connect.js
@@ -5,7 +5,7 @@ const Msg = require("../../models/msg");
exports.commands = ["connect", "server"];
exports.allowDisconnected = true;
-exports.input = function(network, chan, cmd, args) {
+exports.input = function (network, chan, cmd, args) {
if (args.length === 0) {
network.userDisconnected = false;
this.save();
diff --git a/src/plugins/inputs/ctcp.js b/src/plugins/inputs/ctcp.js
index 6ed876e2..ed263a9a 100644
--- a/src/plugins/inputs/ctcp.js
+++ b/src/plugins/inputs/ctcp.js
@@ -4,7 +4,7 @@ const Msg = require("../../models/msg");
exports.commands = ["ctcp"];
-exports.input = function({irc}, chan, cmd, args) {
+exports.input = function ({irc}, chan, cmd, args) {
if (args.length < 2) {
chan.pushMessage(
this,
diff --git a/src/plugins/inputs/disconnect.js b/src/plugins/inputs/disconnect.js
index 3fe2aa30..7b94b925 100644
--- a/src/plugins/inputs/disconnect.js
+++ b/src/plugins/inputs/disconnect.js
@@ -3,7 +3,7 @@
exports.commands = ["disconnect"];
exports.allowDisconnected = true;
-exports.input = function(network, chan, cmd, args) {
+exports.input = function (network, chan, cmd, args) {
const quitMessage = args[0] ? args.join(" ") : null;
network.quit(quitMessage);
diff --git a/src/plugins/inputs/ignore.js b/src/plugins/inputs/ignore.js
index fe8ef610..b2e2dfd9 100644
--- a/src/plugins/inputs/ignore.js
+++ b/src/plugins/inputs/ignore.js
@@ -6,7 +6,7 @@ const Helper = require("../../helper");
exports.commands = ["ignore", "unignore", "ignorelist"];
-exports.input = function(network, chan, cmd, args) {
+exports.input = function (network, chan, cmd, args) {
const client = this;
let target;
let hostmask;
@@ -41,7 +41,7 @@ exports.input = function(network, chan, cmd, args) {
})
);
} else if (
- !network.ignoreList.some(function(entry) {
+ !network.ignoreList.some(function (entry) {
return Helper.compareHostmask(entry, hostmask);
})
) {
@@ -70,7 +70,7 @@ exports.input = function(network, chan, cmd, args) {
}
case "unignore": {
- const idx = network.ignoreList.findIndex(function(entry) {
+ const idx = network.ignoreList.findIndex(function (entry) {
return Helper.compareHostmask(entry, hostmask);
});
diff --git a/src/plugins/inputs/index.js b/src/plugins/inputs/index.js
index 7bae9e62..911d06cb 100644
--- a/src/plugins/inputs/index.js
+++ b/src/plugins/inputs/index.js
@@ -35,7 +35,7 @@ const userInputs = [
"rejoin",
"topic",
"whois",
-].reduce(function(plugins, name) {
+].reduce(function (plugins, name) {
const plugin = require(`./${name}`);
plugin.commands.forEach((command) => plugins.set(command, plugin));
return plugins;
diff --git a/src/plugins/inputs/invite.js b/src/plugins/inputs/invite.js
index 78351bb6..962cfb33 100644
--- a/src/plugins/inputs/invite.js
+++ b/src/plugins/inputs/invite.js
@@ -5,7 +5,7 @@ const Msg = require("../../models/msg");
exports.commands = ["invite", "invitelist"];
-exports.input = function({irc}, chan, cmd, args) {
+exports.input = function ({irc}, chan, cmd, args) {
if (cmd === "invitelist") {
irc.inviteList(chan.name);
return;
diff --git a/src/plugins/inputs/kick.js b/src/plugins/inputs/kick.js
index 972af2a0..e8307a74 100644
--- a/src/plugins/inputs/kick.js
+++ b/src/plugins/inputs/kick.js
@@ -5,7 +5,7 @@ const Msg = require("../../models/msg");
exports.commands = ["kick"];
-exports.input = function({irc}, chan, cmd, args) {
+exports.input = function ({irc}, chan, cmd, args) {
if (chan.type !== Chan.Type.CHANNEL) {
chan.pushMessage(
this,
diff --git a/src/plugins/inputs/kill.js b/src/plugins/inputs/kill.js
index 2e87007c..38423948 100644
--- a/src/plugins/inputs/kill.js
+++ b/src/plugins/inputs/kill.js
@@ -2,7 +2,7 @@
exports.commands = ["kill"];
-exports.input = function({irc}, chan, cmd, args) {
+exports.input = function ({irc}, chan, cmd, args) {
if (args.length !== 0) {
irc.raw("KILL", args[0], args.slice(1).join(" "));
}
diff --git a/src/plugins/inputs/list.js b/src/plugins/inputs/list.js
index 7d1e6fcc..220c0069 100644
--- a/src/plugins/inputs/list.js
+++ b/src/plugins/inputs/list.js
@@ -2,7 +2,7 @@
exports.commands = ["list"];
-exports.input = function(network, chan, cmd, args) {
+exports.input = function (network, chan, cmd, args) {
network.chanCache = [];
network.irc.list(...args);
return true;
diff --git a/src/plugins/inputs/mode.js b/src/plugins/inputs/mode.js
index a16a6bb1..4598a566 100644
--- a/src/plugins/inputs/mode.js
+++ b/src/plugins/inputs/mode.js
@@ -5,7 +5,7 @@ const Msg = require("../../models/msg");
exports.commands = ["mode", "op", "deop", "hop", "dehop", "voice", "devoice"];
-exports.input = function({irc, nick}, chan, cmd, args) {
+exports.input = function ({irc, nick}, chan, cmd, args) {
if (cmd !== "mode") {
if (chan.type !== Chan.Type.CHANNEL) {
chan.pushMessage(
@@ -40,7 +40,7 @@ exports.input = function({irc, nick}, chan, cmd, args) {
devoice: "-v",
}[cmd];
- args.forEach(function(target) {
+ args.forEach(function (target) {
irc.raw("MODE", chan.name, mode, target);
});
diff --git a/src/plugins/inputs/msg.js b/src/plugins/inputs/msg.js
index 9f2c74db..36cf10cb 100644
--- a/src/plugins/inputs/msg.js
+++ b/src/plugins/inputs/msg.js
@@ -15,7 +15,7 @@ function getTarget(cmd, args, chan) {
}
}
-exports.input = function(network, chan, cmd, args) {
+exports.input = function (network, chan, cmd, args) {
let targetName = getTarget(cmd, args, chan);
if (cmd === "query") {
diff --git a/src/plugins/inputs/nick.js b/src/plugins/inputs/nick.js
index 557f2e80..40e180eb 100644
--- a/src/plugins/inputs/nick.js
+++ b/src/plugins/inputs/nick.js
@@ -5,7 +5,7 @@ const Msg = require("../../models/msg");
exports.commands = ["nick"];
exports.allowDisconnected = true;
-exports.input = function(network, chan, cmd, args) {
+exports.input = function (network, chan, cmd, args) {
if (args.length === 0) {
chan.pushMessage(
this,
diff --git a/src/plugins/inputs/notice.js b/src/plugins/inputs/notice.js
index 40823eeb..6569719f 100644
--- a/src/plugins/inputs/notice.js
+++ b/src/plugins/inputs/notice.js
@@ -2,7 +2,7 @@
exports.commands = ["notice"];
-exports.input = function(network, chan, cmd, args) {
+exports.input = function (network, chan, cmd, args) {
if (!args[1]) {
return;
}
diff --git a/src/plugins/inputs/part.js b/src/plugins/inputs/part.js
index 547fbcb2..f049d5b8 100644
--- a/src/plugins/inputs/part.js
+++ b/src/plugins/inputs/part.js
@@ -8,7 +8,7 @@ const Helper = require("../../helper");
exports.commands = ["close", "leave", "part"];
exports.allowDisconnected = true;
-exports.input = function(network, chan, cmd, args) {
+exports.input = function (network, chan, cmd, args) {
let target = chan;
if (args.length > 0) {
diff --git a/src/plugins/inputs/quit.js b/src/plugins/inputs/quit.js
index 0bce3fa3..e9f6f9ff 100644
--- a/src/plugins/inputs/quit.js
+++ b/src/plugins/inputs/quit.js
@@ -5,7 +5,7 @@ const _ = require("lodash");
exports.commands = ["quit"];
exports.allowDisconnected = true;
-exports.input = function(network, chan, cmd, args) {
+exports.input = function (network, chan, cmd, args) {
const client = this;
client.networks = _.without(client.networks, network);
diff --git a/src/plugins/inputs/raw.js b/src/plugins/inputs/raw.js
index 74b0a8d3..816cfaae 100644
--- a/src/plugins/inputs/raw.js
+++ b/src/plugins/inputs/raw.js
@@ -2,7 +2,7 @@
exports.commands = ["raw", "send", "quote"];
-exports.input = function({irc}, chan, cmd, args) {
+exports.input = function ({irc}, chan, cmd, args) {
if (args.length !== 0) {
irc.connection.write(args.join(" "));
}
diff --git a/src/plugins/inputs/rejoin.js b/src/plugins/inputs/rejoin.js
index 28bb57a9..1b215733 100644
--- a/src/plugins/inputs/rejoin.js
+++ b/src/plugins/inputs/rejoin.js
@@ -5,7 +5,7 @@ const Chan = require("../../models/chan");
exports.commands = ["cycle", "rejoin"];
-exports.input = function({irc}, chan) {
+exports.input = function ({irc}, chan) {
if (chan.type !== Chan.Type.CHANNEL) {
chan.pushMessage(
this,
diff --git a/src/plugins/inputs/topic.js b/src/plugins/inputs/topic.js
index eb76182b..a26b8106 100644
--- a/src/plugins/inputs/topic.js
+++ b/src/plugins/inputs/topic.js
@@ -5,7 +5,7 @@ const Msg = require("../../models/msg");
exports.commands = ["topic"];
-exports.input = function({irc}, chan, cmd, args) {
+exports.input = function ({irc}, chan, cmd, args) {
if (chan.type !== Chan.Type.CHANNEL) {
chan.pushMessage(
this,
diff --git a/src/plugins/inputs/whois.js b/src/plugins/inputs/whois.js
index 805b9bf1..480a72dc 100644
--- a/src/plugins/inputs/whois.js
+++ b/src/plugins/inputs/whois.js
@@ -2,7 +2,7 @@
exports.commands = ["whois"];
-exports.input = function({irc}, chan, cmd, args) {
+exports.input = function ({irc}, chan, cmd, args) {
if (args.length === 1) {
// This queries server of the other user and not of the current user, which
// does not know idle time.
diff --git a/src/plugins/irc-events/away.js b/src/plugins/irc-events/away.js
index b82ae66f..a21a463b 100644
--- a/src/plugins/irc-events/away.js
+++ b/src/plugins/irc-events/away.js
@@ -3,7 +3,7 @@
const Chan = require("../../models/chan");
const Msg = require("../../models/msg");
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
irc.on("away", (data) => handleAway(Msg.Type.AWAY, data));
diff --git a/src/plugins/irc-events/cap.js b/src/plugins/irc-events/cap.js
index da20d3cc..18e78cf7 100644
--- a/src/plugins/irc-events/cap.js
+++ b/src/plugins/irc-events/cap.js
@@ -3,7 +3,7 @@
const Msg = require("../../models/msg");
const STSPolicies = require("../sts");
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
irc.on("cap ls", (data) => {
diff --git a/src/plugins/irc-events/chghost.js b/src/plugins/irc-events/chghost.js
index 0be9d775..492cdf55 100644
--- a/src/plugins/irc-events/chghost.js
+++ b/src/plugins/irc-events/chghost.js
@@ -2,12 +2,12 @@
const Msg = require("../../models/msg");
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
// If server supports CHGHOST cap, then changing the hostname does not require
// sending PART and JOIN, which means less work for us over all
- irc.on("user updated", function(data) {
+ irc.on("user updated", function (data) {
network.channels.forEach((chan) => {
const user = chan.findUser(data.nick);
diff --git a/src/plugins/irc-events/connection.js b/src/plugins/irc-events/connection.js
index a50492fe..d271a65b 100644
--- a/src/plugins/irc-events/connection.js
+++ b/src/plugins/irc-events/connection.js
@@ -6,7 +6,7 @@ const Msg = require("../../models/msg");
const Chan = require("../../models/chan");
const Helper = require("../../helper");
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
network.channels[0].pushMessage(
@@ -17,7 +17,7 @@ module.exports = function(irc, network) {
true
);
- irc.on("registered", function() {
+ irc.on("registered", function () {
if (network.irc.network.cap.enabled.length > 0) {
network.channels[0].pushMessage(
client,
@@ -40,7 +40,7 @@ module.exports = function(irc, network) {
if (Array.isArray(network.commands)) {
network.commands.forEach((cmd) => {
- setTimeout(function() {
+ setTimeout(function () {
client.input({
target: network.channels[0].id,
text: cmd,
@@ -55,16 +55,16 @@ module.exports = function(irc, network) {
return;
}
- setTimeout(function() {
+ setTimeout(function () {
network.irc.join(chan.name, chan.key);
}, delay);
delay += 1000;
});
});
- irc.on("socket connected", function() {
+ irc.on("socket connected", function () {
network.prefixLookup = {};
- irc.network.options.PREFIX.forEach(function(mode) {
+ irc.network.options.PREFIX.forEach(function (mode) {
network.prefixLookup[mode.mode] = mode.symbol;
});
@@ -79,7 +79,7 @@ module.exports = function(irc, network) {
sendStatus();
});
- irc.on("close", function() {
+ irc.on("close", function () {
network.channels[0].pushMessage(
client,
new Msg({
@@ -92,7 +92,7 @@ module.exports = function(irc, network) {
let identSocketId;
- irc.on("raw socket connected", function(socket) {
+ irc.on("raw socket connected", function (socket) {
let ident = client.name || network.username;
if (Helper.config.useHexIp) {
@@ -102,7 +102,7 @@ module.exports = function(irc, network) {
identSocketId = client.manager.identHandler.addSocket(socket, ident);
});
- irc.on("socket close", function(error) {
+ irc.on("socket close", function (error) {
if (identSocketId > 0) {
client.manager.identHandler.removeSocket(identSocketId);
identSocketId = 0;
@@ -141,7 +141,7 @@ module.exports = function(irc, network) {
});
if (Helper.config.debug.ircFramework) {
- irc.on("debug", function(message) {
+ irc.on("debug", function (message) {
log.debug(
`[${client.name} (${client.id}) on ${network.name} (${network.uuid}]`,
message
@@ -150,7 +150,7 @@ module.exports = function(irc, network) {
}
if (Helper.config.debug.raw) {
- irc.on("raw", function(message) {
+ irc.on("raw", function (message) {
network.channels[0].pushMessage(
client,
new Msg({
@@ -163,7 +163,7 @@ module.exports = function(irc, network) {
});
}
- irc.on("socket error", function(err) {
+ irc.on("socket error", function (err) {
network.channels[0].pushMessage(
client,
new Msg({
@@ -174,7 +174,7 @@ module.exports = function(irc, network) {
);
});
- irc.on("reconnecting", function(data) {
+ irc.on("reconnecting", function (data) {
network.channels[0].pushMessage(
client,
new Msg({
@@ -191,7 +191,7 @@ module.exports = function(irc, network) {
);
});
- irc.on("ping timeout", function() {
+ irc.on("ping timeout", function () {
network.channels[0].pushMessage(
client,
new Msg({
@@ -201,7 +201,7 @@ module.exports = function(irc, network) {
);
});
- irc.on("server options", function(data) {
+ irc.on("server options", function (data) {
network.prefixLookup = {};
data.options.PREFIX.forEach((mode) => {
diff --git a/src/plugins/irc-events/ctcp.js b/src/plugins/irc-events/ctcp.js
index 37ba2243..ff74319c 100644
--- a/src/plugins/irc-events/ctcp.js
+++ b/src/plugins/irc-events/ctcp.js
@@ -16,12 +16,12 @@ const ctcpResponses = {
VERSION: () => pkg.name + " " + Helper.getVersion() + " -- " + pkg.homepage,
};
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
const lobby = network.channels[0];
- irc.on("ctcp response", function(data) {
- const shouldIgnore = network.ignoreList.some(function(entry) {
+ irc.on("ctcp response", function (data) {
+ const shouldIgnore = network.ignoreList.some(function (entry) {
return Helper.compareHostmask(entry, data);
});
@@ -59,7 +59,7 @@ module.exports = function(irc, network) {
return;
}
- const shouldIgnore = network.ignoreList.some(function(entry) {
+ const shouldIgnore = network.ignoreList.some(function (entry) {
return Helper.compareHostmask(entry, data);
});
diff --git a/src/plugins/irc-events/error.js b/src/plugins/irc-events/error.js
index 9c146502..e369366a 100644
--- a/src/plugins/irc-events/error.js
+++ b/src/plugins/irc-events/error.js
@@ -3,10 +3,10 @@
const Msg = require("../../models/msg");
const Helper = require("../../helper");
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
- irc.on("irc error", function(data) {
+ irc.on("irc error", function (data) {
const msg = new Msg({
type: Msg.Type.ERROR,
error: data.error,
@@ -33,7 +33,7 @@ module.exports = function(irc, network) {
target.pushMessage(client, msg, true);
});
- irc.on("nick in use", function(data) {
+ irc.on("nick in use", function (data) {
let message = data.nick + ": " + (data.reason || "Nickname is already in use.");
if (irc.connection.registered === false && !Helper.config.public) {
@@ -65,7 +65,7 @@ module.exports = function(irc, network) {
});
});
- irc.on("nick invalid", function(data) {
+ irc.on("nick invalid", function (data) {
const lobby = network.channels[0];
const msg = new Msg({
type: Msg.Type.ERROR,
diff --git a/src/plugins/irc-events/invite.js b/src/plugins/irc-events/invite.js
index 4bdd6d7f..2d0ffc45 100644
--- a/src/plugins/irc-events/invite.js
+++ b/src/plugins/irc-events/invite.js
@@ -2,10 +2,10 @@
const Msg = require("../../models/msg");
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
- irc.on("invite", function(data) {
+ irc.on("invite", function (data) {
let chan = network.getChannel(data.channel);
if (typeof chan === "undefined") {
diff --git a/src/plugins/irc-events/join.js b/src/plugins/irc-events/join.js
index 7181f88f..79aa9cf4 100644
--- a/src/plugins/irc-events/join.js
+++ b/src/plugins/irc-events/join.js
@@ -4,10 +4,10 @@ const Chan = require("../../models/chan");
const Msg = require("../../models/msg");
const User = require("../../models/user");
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
- irc.on("join", function(data) {
+ irc.on("join", function (data) {
let chan = network.getChannel(data.channel);
if (typeof chan === "undefined") {
diff --git a/src/plugins/irc-events/kick.js b/src/plugins/irc-events/kick.js
index 3cd2590f..6bf5f309 100644
--- a/src/plugins/irc-events/kick.js
+++ b/src/plugins/irc-events/kick.js
@@ -3,10 +3,10 @@
const Chan = require("../../models/chan");
const Msg = require("../../models/msg");
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
- irc.on("kick", function(data) {
+ irc.on("kick", function (data) {
const chan = network.getChannel(data.channel);
if (typeof chan === "undefined") {
diff --git a/src/plugins/irc-events/link.js b/src/plugins/irc-events/link.js
index a2f85791..b2a12d38 100644
--- a/src/plugins/irc-events/link.js
+++ b/src/plugins/irc-events/link.js
@@ -12,7 +12,7 @@ const currentFetchPromises = new Map();
const imageTypeRegex = /^image\/.+/;
const mediaTypeRegex = /^(audio|video)\/.+/;
-module.exports = function(client, chan, msg) {
+module.exports = function (client, chan, msg) {
if (!Helper.config.prefetch) {
return;
}
@@ -78,9 +78,7 @@ function parseHtml(preview, res, client) {
preview.type = "link";
preview.head =
$('meta[property="og:title"]').attr("content") ||
- $("head > title, title")
- .first()
- .text() ||
+ $("head > title, title").first().text() ||
"";
preview.body =
$('meta[property="og:description"]').attr("content") ||
@@ -136,7 +134,7 @@ function parseHtmlMedia($, preview, client) {
return;
}
- $(`meta[property="og:${type}:type"]`).each(function(i) {
+ $(`meta[property="og:${type}:type"]`).each(function (i) {
const mimeType = $(this).attr("content");
if (mediaTypeRegex.test(mimeType)) {
@@ -360,7 +358,7 @@ function fetch(uri, headers) {
});
gotStream
- .on("response", function(res) {
+ .on("response", function (res) {
contentLength = parseInt(res.headers["content-length"], 10) || 0;
contentType = res.headers["content-type"];
diff --git a/src/plugins/irc-events/list.js b/src/plugins/irc-events/list.js
index 5b7f7c78..2e0abeca 100644
--- a/src/plugins/irc-events/list.js
+++ b/src/plugins/irc-events/list.js
@@ -2,11 +2,11 @@
const Chan = require("../../models/chan");
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
const MAX_CHANS = 500;
- irc.on("channel list start", function() {
+ irc.on("channel list start", function () {
network.chanCache = [];
updateListStatus({
@@ -14,7 +14,7 @@ module.exports = function(irc, network) {
});
});
- irc.on("channel list", function(channels) {
+ irc.on("channel list", function (channels) {
Array.prototype.push.apply(network.chanCache, channels);
updateListStatus({
@@ -22,7 +22,7 @@ module.exports = function(irc, network) {
});
});
- irc.on("channel list end", function() {
+ irc.on("channel list end", function () {
updateListStatus(
network.chanCache.sort((a, b) => b.num_users - a.num_users).slice(0, MAX_CHANS)
);
diff --git a/src/plugins/irc-events/message.js b/src/plugins/irc-events/message.js
index 0798e4c2..e1f3f2ca 100644
--- a/src/plugins/irc-events/message.js
+++ b/src/plugins/irc-events/message.js
@@ -7,10 +7,10 @@ const cleanIrcMessage = require("../../../client/js/helpers/ircmessageparser/cle
const Helper = require("../../helper");
const nickRegExp = /(?:\x03[0-9]{1,2}(?:,[0-9]{1,2})?)?([\w[\]\\`^{|}-]+)/g;
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
- irc.on("notice", function(data) {
+ irc.on("notice", function (data) {
// Some servers send notices without any nickname
if (!data.nick) {
data.from_server = true;
@@ -21,17 +21,17 @@ module.exports = function(irc, network) {
handleMessage(data);
});
- irc.on("action", function(data) {
+ irc.on("action", function (data) {
data.type = Msg.Type.ACTION;
handleMessage(data);
});
- irc.on("privmsg", function(data) {
+ irc.on("privmsg", function (data) {
data.type = Msg.Type.MESSAGE;
handleMessage(data);
});
- irc.on("wallops", function(data) {
+ irc.on("wallops", function (data) {
data.from_server = true;
data.type = Msg.Type.NOTICE;
handleMessage(data);
@@ -47,7 +47,7 @@ module.exports = function(irc, network) {
// Check if the sender is in our ignore list
const shouldIgnore =
!self &&
- network.ignoreList.some(function(entry) {
+ network.ignoreList.some(function (entry) {
return Helper.compareHostmask(entry, data);
});
diff --git a/src/plugins/irc-events/mode.js b/src/plugins/irc-events/mode.js
index 91eb8589..d09bdd3e 100644
--- a/src/plugins/irc-events/mode.js
+++ b/src/plugins/irc-events/mode.js
@@ -3,14 +3,14 @@
const _ = require("lodash");
const Msg = require("../../models/msg");
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
// The following saves the channel key based on channel mode instead of
// extracting it from `/join #channel key`. This lets us not have to
// temporarily store the key until successful join, but also saves the key
// if a key is set or changed while being on the channel.
- irc.on("channel info", function(data) {
+ irc.on("channel info", function (data) {
if (!data.modes) {
return;
}
@@ -39,7 +39,7 @@ module.exports = function(irc, network) {
targetChan.pushMessage(client, msg);
});
- irc.on("mode", function(data) {
+ irc.on("mode", function (data) {
let targetChan;
if (data.target === irc.user.nick) {
@@ -113,7 +113,7 @@ module.exports = function(irc, network) {
_.pull(user.modes, changedMode);
} else if (!user.modes.includes(changedMode)) {
user.modes.push(changedMode);
- user.modes.sort(function(a, b) {
+ user.modes.sort(function (a, b) {
return userModeSortPriority[a] - userModeSortPriority[b];
});
}
diff --git a/src/plugins/irc-events/modelist.js b/src/plugins/irc-events/modelist.js
index afb79e29..202a2543 100644
--- a/src/plugins/irc-events/modelist.js
+++ b/src/plugins/irc-events/modelist.js
@@ -3,7 +3,7 @@
const Chan = require("../../models/chan");
const Msg = require("../../models/msg");
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
irc.on("banlist", (list) => {
diff --git a/src/plugins/irc-events/motd.js b/src/plugins/irc-events/motd.js
index 1d222287..6c2e1442 100644
--- a/src/plugins/irc-events/motd.js
+++ b/src/plugins/irc-events/motd.js
@@ -2,10 +2,10 @@
const Msg = require("../../models/msg");
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
- irc.on("motd", function(data) {
+ irc.on("motd", function (data) {
const lobby = network.channels[0];
if (data.motd) {
diff --git a/src/plugins/irc-events/names.js b/src/plugins/irc-events/names.js
index 2c6097f2..2e0a7db8 100644
--- a/src/plugins/irc-events/names.js
+++ b/src/plugins/irc-events/names.js
@@ -1,9 +1,9 @@
"use strict";
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
- irc.on("userlist", function(data) {
+ irc.on("userlist", function (data) {
const chan = network.getChannel(data.channel);
if (typeof chan === "undefined") {
diff --git a/src/plugins/irc-events/nick.js b/src/plugins/irc-events/nick.js
index 39dc27fa..dc930c28 100644
--- a/src/plugins/irc-events/nick.js
+++ b/src/plugins/irc-events/nick.js
@@ -2,10 +2,10 @@
const Msg = require("../../models/msg");
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
- irc.on("nick", function(data) {
+ irc.on("nick", function (data) {
const self = data.nick === irc.user.nick;
if (self) {
diff --git a/src/plugins/irc-events/part.js b/src/plugins/irc-events/part.js
index 851f3b1e..8565a0be 100644
--- a/src/plugins/irc-events/part.js
+++ b/src/plugins/irc-events/part.js
@@ -3,10 +3,10 @@
const _ = require("lodash");
const Msg = require("../../models/msg");
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
- irc.on("part", function(data) {
+ irc.on("part", function (data) {
const chan = network.getChannel(data.channel);
if (typeof chan === "undefined") {
diff --git a/src/plugins/irc-events/quit.js b/src/plugins/irc-events/quit.js
index 13ff2a8c..636cae35 100644
--- a/src/plugins/irc-events/quit.js
+++ b/src/plugins/irc-events/quit.js
@@ -2,10 +2,10 @@
const Msg = require("../../models/msg");
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
- irc.on("quit", function(data) {
+ irc.on("quit", function (data) {
network.channels.forEach((chan) => {
const user = chan.findUser(data.nick);
diff --git a/src/plugins/irc-events/topic.js b/src/plugins/irc-events/topic.js
index d0e2d800..dedc53e7 100644
--- a/src/plugins/irc-events/topic.js
+++ b/src/plugins/irc-events/topic.js
@@ -2,10 +2,10 @@
const Msg = require("../../models/msg");
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
- irc.on("topic", function(data) {
+ irc.on("topic", function (data) {
const chan = network.getChannel(data.channel);
if (typeof chan === "undefined") {
@@ -28,7 +28,7 @@ module.exports = function(irc, network) {
});
});
- irc.on("topicsetby", function(data) {
+ irc.on("topicsetby", function (data) {
const chan = network.getChannel(data.channel);
if (typeof chan === "undefined") {
diff --git a/src/plugins/irc-events/unhandled.js b/src/plugins/irc-events/unhandled.js
index 4c976ba4..e0b4a134 100644
--- a/src/plugins/irc-events/unhandled.js
+++ b/src/plugins/irc-events/unhandled.js
@@ -2,10 +2,10 @@
const Msg = require("../../models/msg");
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
- irc.on("unknown command", function(command) {
+ irc.on("unknown command", function (command) {
let target = network.channels[0];
// Do not display users own name
diff --git a/src/plugins/irc-events/welcome.js b/src/plugins/irc-events/welcome.js
index 2e258bb8..21d8a70f 100644
--- a/src/plugins/irc-events/welcome.js
+++ b/src/plugins/irc-events/welcome.js
@@ -2,10 +2,10 @@
const Msg = require("../../models/msg");
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
- irc.on("registered", function(data) {
+ irc.on("registered", function (data) {
network.setNick(data.nick);
const lobby = network.channels[0];
diff --git a/src/plugins/irc-events/whois.js b/src/plugins/irc-events/whois.js
index 54d6f954..c0ceef77 100644
--- a/src/plugins/irc-events/whois.js
+++ b/src/plugins/irc-events/whois.js
@@ -3,7 +3,7 @@
const Chan = require("../../models/chan");
const Msg = require("../../models/msg");
-module.exports = function(irc, network) {
+module.exports = function (irc, network) {
const client = this;
irc.on("whois", handleWhois);
diff --git a/src/plugins/packages/index.js b/src/plugins/packages/index.js
index 04e6d765..d0ec3943 100644
--- a/src/plugins/packages/index.js
+++ b/src/plugins/packages/index.js
@@ -30,7 +30,7 @@ module.exports = {
outdated,
};
-const packageApis = function(packageInfo) {
+const packageApis = function (packageInfo) {
return {
Stylesheets: {
addFile: addStylesheet.bind(this, packageInfo.packageName),
diff --git a/src/plugins/storage.js b/src/plugins/storage.js
index 0a7708f7..603d136b 100644
--- a/src/plugins/storage.js
+++ b/src/plugins/storage.js
@@ -43,10 +43,7 @@ class Storage {
}
store(data, extension, callback) {
- const hash = crypto
- .createHash("sha256")
- .update(data)
- .digest("hex");
+ const hash = crypto.createHash("sha256").update(data).digest("hex");
const a = hash.substring(0, 2);
const b = hash.substring(2, 4);
const folder = path.join(helper.getStoragePath(), a, b);
diff --git a/src/server.js b/src/server.js
index b0e5e034..0d450117 100644
--- a/src/server.js
+++ b/src/server.js
@@ -32,7 +32,7 @@ const serverHash = Math.floor(Date.now() * Math.random());
let manager = null;
-module.exports = function(options = {}) {
+module.exports = function (options = {}) {
log.info(`The Lounge ${colors.green(Helper.getVersion())} \
(Node.js ${colors.green(process.versions.node)} on ${colors.green(process.platform)} ${
process.arch
@@ -206,7 +206,7 @@ module.exports = function(options = {}) {
// Handle ctrl+c and kill gracefully
let suicideTimeout = null;
- const exitGracefully = function() {
+ const exitGracefully = function () {
if (suicideTimeout !== null) {
return;
}
@@ -361,7 +361,7 @@ function initializeClient(socket, client, token, lastMessage, openChannel) {
new Uploader(socket);
}
- socket.on("disconnect", function() {
+ socket.on("disconnect", function () {
process.nextTick(() => client.clientDetach(socket.id));
});
@@ -784,7 +784,7 @@ function performAuthentication(data) {
client = new Client(manager);
manager.clients.push(client);
- socket.on("disconnect", function() {
+ socket.on("disconnect", function () {
manager.clients = _.without(manager.clients, client);
client.quit();
});
diff --git a/test/client/js/authTest.js b/test/client/js/authTest.js
index b4fa4fc2..c55eb880 100644
--- a/test/client/js/authTest.js
+++ b/test/client/js/authTest.js
@@ -6,24 +6,24 @@ const Auth = require("../../../client/js/auth").default;
const localStorage = require("../../../client/js/localStorage").default;
const location = require("../../../client/js/location").default;
-describe("Auth", function() {
- describe(".signout", function() {
- beforeEach(function() {
+describe("Auth", function () {
+ describe(".signout", function () {
+ beforeEach(function () {
stub(localStorage, "clear");
stub(location, "reload");
});
- afterEach(function() {
+ afterEach(function () {
localStorage.clear.restore();
location.reload.restore();
});
- it("should empty the local storage", function() {
+ it("should empty the local storage", function () {
Auth.signout();
expect(localStorage.clear.calledOnce).to.be.true;
});
- it("should reload the page", function() {
+ it("should reload the page", function () {
Auth.signout();
expect(location.reload.calledOnce).to.be.true;
});
diff --git a/test/client/js/constantsTest.js b/test/client/js/constantsTest.js
index 853d12a9..ecf2730b 100644
--- a/test/client/js/constantsTest.js
+++ b/test/client/js/constantsTest.js
@@ -3,15 +3,13 @@
const expect = require("chai").expect;
const constants = require("../../../client/js/constants");
-describe("client-side constants", function() {
- describe(".colorCodeMap", function() {
- it("should be a non-empty array", function() {
- expect(constants.colorCodeMap)
- .to.be.an("array")
- .of.length(16);
+describe("client-side constants", function () {
+ describe(".colorCodeMap", function () {
+ it("should be a non-empty array", function () {
+ expect(constants.colorCodeMap).to.be.an("array").of.length(16);
});
- it("should be made of pairs of strings", function() {
+ it("should be made of pairs of strings", function () {
constants.colorCodeMap.forEach(([code, name]) => {
expect(code)
.to.be.a("string")
@@ -21,22 +19,20 @@ describe("client-side constants", function() {
});
});
- describe(".condensedTypes", function() {
- it("should be a non-empty array", function() {
+ describe(".condensedTypes", function () {
+ it("should be a non-empty array", function () {
expect(constants.condensedTypes).to.be.an.instanceof(Set).that.is.not.empty;
});
- it("should only contain ASCII strings", function() {
+ it("should only contain ASCII strings", function () {
constants.condensedTypes.forEach((type) => {
- expect(type)
- .to.be.a("string")
- .that.does.match(/^\w+$/);
+ expect(type).to.be.a("string").that.does.match(/^\w+$/);
});
});
});
- describe(".timeFormats", function() {
- it("should be objects of strings", function() {
+ describe(".timeFormats", function () {
+ it("should be objects of strings", function () {
expect(constants.timeFormats.msgDefault).to.be.an("string").that.is.not.empty;
expect(constants.timeFormats.msgWithSeconds).to.be.an("string").that.is.not.empty;
});
diff --git a/test/client/js/helpers/friendlysizeTest.js b/test/client/js/helpers/friendlysizeTest.js
index 5eb8fe2a..6cc5a183 100644
--- a/test/client/js/helpers/friendlysizeTest.js
+++ b/test/client/js/helpers/friendlysizeTest.js
@@ -3,8 +3,8 @@
const expect = require("chai").expect;
const friendlysize = require("../../../../client/js/helpers/friendlysize").default;
-describe("friendlysize helper", function() {
- it("should render human-readable version", function() {
+describe("friendlysize helper", function () {
+ it("should render human-readable version", function () {
expect(friendlysize(51200)).to.equal("50 KiB");
expect(friendlysize(2)).to.equal("2 Bytes");
expect(friendlysize(1023)).to.equal("1023 Bytes");
@@ -15,15 +15,15 @@ describe("friendlysize helper", function() {
expect(friendlysize(Math.pow(1024, 5))).to.equal("1 PiB");
});
- it("should round with 1 digit", function() {
+ it("should round with 1 digit", function () {
expect(friendlysize(1234567)).to.equal("1.2 MiB");
});
- it("should render special case 0 as 0 Bytes", function() {
+ it("should render special case 0 as 0 Bytes", function () {
expect(friendlysize(0)).to.equal("0 Bytes");
});
- it("should render max safe integer as petabytes", function() {
+ it("should render max safe integer as petabytes", function () {
expect(friendlysize(Number.MAX_SAFE_INTEGER)).to.equal("8 PiB");
});
});
diff --git a/test/client/js/helpers/ircmessageparser/cleanIrcMessage.js b/test/client/js/helpers/ircmessageparser/cleanIrcMessage.js
index ba668636..2636b29f 100644
--- a/test/client/js/helpers/ircmessageparser/cleanIrcMessage.js
+++ b/test/client/js/helpers/ircmessageparser/cleanIrcMessage.js
@@ -3,8 +3,8 @@
const expect = require("chai").expect;
const cleanIrcMessage = require("../../../../../client/js/helpers/ircmessageparser/cleanIrcMessage");
-describe("cleanIrcMessage", function() {
- it("should remove all formatting", function() {
+describe("cleanIrcMessage", function () {
+ it("should remove all formatting", function () {
const testCases = [
{
input: "\x0303",
diff --git a/test/client/js/helpers/parseIrcUri.js b/test/client/js/helpers/parseIrcUri.js
index 968cf103..af307513 100644
--- a/test/client/js/helpers/parseIrcUri.js
+++ b/test/client/js/helpers/parseIrcUri.js
@@ -3,8 +3,8 @@
const expect = require("chai").expect;
const parseIrcUri = require("../../../../client/js/helpers/parseIrcUri").default;
-describe("parseIrcUri helper", function() {
- it("should parse irc:// without port", function() {
+describe("parseIrcUri helper", function () {
+ it("should parse irc:// without port", function () {
expect(parseIrcUri("irc://example.com")).to.deep.equal({
tls: false,
name: "example.com",
@@ -14,7 +14,7 @@ describe("parseIrcUri helper", function() {
});
});
- it("should parse ircs:// without port", function() {
+ it("should parse ircs:// without port", function () {
expect(parseIrcUri("ircs://example.com")).to.deep.equal({
tls: true,
name: "example.com",
@@ -24,7 +24,7 @@ describe("parseIrcUri helper", function() {
});
});
- it("should parse irc:// with port", function() {
+ it("should parse irc:// with port", function () {
expect(parseIrcUri("irc://example.com:1337")).to.deep.equal({
tls: false,
name: "example.com",
@@ -34,7 +34,7 @@ describe("parseIrcUri helper", function() {
});
});
- it("should parse ircs:// with port", function() {
+ it("should parse ircs:// with port", function () {
expect(parseIrcUri("ircs://example.com:1337")).to.deep.equal({
tls: true,
name: "example.com",
@@ -44,15 +44,15 @@ describe("parseIrcUri helper", function() {
});
});
- it("should not parse invalid port", function() {
+ it("should not parse invalid port", function () {
expect(parseIrcUri("ircs://example.com:lol")).to.deep.equal({});
});
- it("should not parse plus in port", function() {
+ it("should not parse plus in port", function () {
expect(parseIrcUri("irc://example.com:+6697")).to.deep.equal({});
});
- it("should not channel on empty query and hash", function() {
+ it("should not channel on empty query and hash", function () {
const obj = {
tls: false,
name: "example.com",
@@ -66,7 +66,7 @@ describe("parseIrcUri helper", function() {
expect(parseIrcUri("irc://example.com/#")).to.deep.equal(obj);
});
- it("should parse multiple channels", function() {
+ it("should parse multiple channels", function () {
const obj = {
tls: true,
name: "example.com",
diff --git a/test/client/js/helpers/roundBadgeNumberTest.js b/test/client/js/helpers/roundBadgeNumberTest.js
index 282e05de..4e158c18 100644
--- a/test/client/js/helpers/roundBadgeNumberTest.js
+++ b/test/client/js/helpers/roundBadgeNumberTest.js
@@ -3,20 +3,20 @@
const expect = require("chai").expect;
const roundBadgeNumber = require("../../../../client/js/helpers/roundBadgeNumber").default;
-describe("roundBadgeNumber helper", function() {
- it("should return any number under 1000 as a string", function() {
+describe("roundBadgeNumber helper", function () {
+ it("should return any number under 1000 as a string", function () {
expect(roundBadgeNumber(123)).to.equal("123");
});
- it("should return numbers above 999 in thousands", function() {
+ it("should return numbers above 999 in thousands", function () {
expect(roundBadgeNumber(1000)).to.be.equal("1.0k");
});
- it("should round and not floor", function() {
+ it("should round and not floor", function () {
expect(roundBadgeNumber(9999)).to.be.equal("10.0k");
});
- it("should always include a single digit when rounding up", function() {
+ it("should always include a single digit when rounding up", function () {
expect(roundBadgeNumber(1234)).to.be.equal("1.2k");
expect(roundBadgeNumber(12345)).to.be.equal("12.3k");
expect(roundBadgeNumber(123456)).to.be.equal("123.4k");
diff --git a/test/commands/mode.js b/test/commands/mode.js
index f1d75795..ab27a9a4 100644
--- a/test/commands/mode.js
+++ b/test/commands/mode.js
@@ -5,8 +5,8 @@ const expect = require("chai").expect;
const Chan = require("../../src/models/chan");
const ModeCommand = require("../../src/plugins/inputs/mode");
-describe("Commands", function() {
- describe("/mode", function() {
+describe("Commands", function () {
+ describe("/mode", function () {
const channel = new Chan({
name: "#thelounge",
});
@@ -26,8 +26,8 @@ describe("Commands", function() {
},
};
- it("should not mess with the given target", function() {
- const test = function(expected, args) {
+ it("should not mess with the given target", function () {
+ const test = function (expected, args) {
ModeCommand.input(testableNetwork, channel, "mode", Array.from(args));
expect(testableNetwork.lastCommand).to.equal(expected);
@@ -43,7 +43,7 @@ describe("Commands", function() {
test("MODE #thelounge", ["#thelounge"]);
});
- it("should assume target if none given", function() {
+ it("should assume target if none given", function () {
ModeCommand.input(testableNetwork, channel, "mode", []);
expect(testableNetwork.lastCommand).to.equal("MODE #thelounge");
@@ -63,7 +63,7 @@ describe("Commands", function() {
expect(testableNetwork.lastCommand).to.equal("MODE xPaw -i idk");
});
- it("should support shorthand commands", function() {
+ it("should support shorthand commands", function () {
ModeCommand.input(testableNetwork, channel, "op", ["xPaw"]);
expect(testableNetwork.lastCommand).to.equal("MODE #thelounge +o xPaw");
diff --git a/test/models/chan.js b/test/models/chan.js
index de01c698..33ee41e5 100644
--- a/test/models/chan.js
+++ b/test/models/chan.js
@@ -5,7 +5,7 @@ const Chan = require("../../src/models/chan");
const Msg = require("../../src/models/msg");
const User = require("../../src/models/user");
-describe("Chan", function() {
+describe("Chan", function () {
const network = {
network: {
options: {
@@ -26,7 +26,7 @@ describe("Chan", function() {
prefixLookup[mode.mode] = mode.symbol;
});
- describe("#findMessage(id)", function() {
+ describe("#findMessage(id)", function () {
const chan = new Chan({
messages: [
new Msg({id: 1}),
@@ -38,24 +38,24 @@ describe("Chan", function() {
],
});
- it("should find a message in the list of messages", function() {
+ it("should find a message in the list of messages", function () {
expect(chan.findMessage(2).text).to.equal("Message to be found");
});
- it("should not find a message that does not exist", function() {
+ it("should not find a message that does not exist", function () {
expect(chan.findMessage(42)).to.be.undefined;
});
});
- describe("#setUser(user)", function() {
- it("should make key lowercase", function() {
+ describe("#setUser(user)", function () {
+ it("should make key lowercase", function () {
const chan = new Chan();
chan.setUser(new User({nick: "TestUser"}));
expect(chan.users.has("testuser")).to.be.true;
});
- it("should update user object", function() {
+ it("should update user object", function () {
const chan = new Chan();
chan.setUser(new User({nick: "TestUser"}, prefixLookup));
chan.setUser(new User({nick: "TestUseR", modes: ["o"]}, prefixLookup));
@@ -65,8 +65,8 @@ describe("Chan", function() {
});
});
- describe("#getUser(nick)", function() {
- it("should returning existing object", function() {
+ describe("#getUser(nick)", function () {
+ it("should returning existing object", function () {
const chan = new Chan();
chan.setUser(new User({nick: "TestUseR", modes: ["o"]}, prefixLookup));
const user = chan.getUser("TestUSER");
@@ -74,7 +74,7 @@ describe("Chan", function() {
expect(user.mode).to.equal("@");
});
- it("should make new User object if not found", function() {
+ it("should make new User object if not found", function () {
const chan = new Chan();
const user = chan.getUser("very-testy-user");
@@ -82,12 +82,12 @@ describe("Chan", function() {
});
});
- describe("#getSortedUsers(irc)", function() {
- const getUserNames = function(chan) {
+ describe("#getSortedUsers(irc)", function () {
+ const getUserNames = function (chan) {
return chan.getSortedUsers(network).map((u) => u.nick);
};
- it("returns unsorted list on null irc object", function() {
+ it("returns unsorted list on null irc object", function () {
const chan = new Chan();
["JocelynD", "YaManicKill", "astorije", "xPaw", "Max-P"].forEach((nick) =>
chan.setUser(new User({nick}))
@@ -102,7 +102,7 @@ describe("Chan", function() {
]);
});
- it("should sort a simple user list", function() {
+ it("should sort a simple user list", function () {
const chan = new Chan();
["JocelynD", "YaManicKill", "astorije", "xPaw", "Max-P"].forEach((nick) =>
chan.setUser(new User({nick}, prefixLookup))
@@ -117,7 +117,7 @@ describe("Chan", function() {
]);
});
- it("should group users by modes", function() {
+ it("should group users by modes", function () {
const chan = new Chan();
chan.setUser(new User({nick: "JocelynD", modes: ["a", "o"]}, prefixLookup));
chan.setUser(new User({nick: "YaManicKill", modes: ["v"]}, prefixLookup));
@@ -134,7 +134,7 @@ describe("Chan", function() {
]);
});
- it("should sort a mix of users and modes", function() {
+ it("should sort a mix of users and modes", function () {
const chan = new Chan();
chan.setUser(new User({nick: "JocelynD"}, prefixLookup));
chan.setUser(new User({nick: "YaManicKill", modes: ["o"]}, prefixLookup));
@@ -151,7 +151,7 @@ describe("Chan", function() {
]);
});
- it("should be case-insensitive", function() {
+ it("should be case-insensitive", function () {
const chan = new Chan();
["aB", "Ad", "AA", "ac"].forEach((nick) =>
chan.setUser(new User({nick}, prefixLookup))
@@ -160,7 +160,7 @@ describe("Chan", function() {
expect(getUserNames(chan)).to.deep.equal(["AA", "aB", "ac", "Ad"]);
});
- it("should parse special characters successfully", function() {
+ it("should parse special characters successfully", function () {
const chan = new Chan();
[
"[foo",
@@ -194,15 +194,15 @@ describe("Chan", function() {
});
});
- describe("#getFilteredClone(lastActiveChannel, lastMessage)", function() {
- it("should send empty user list", function() {
+ describe("#getFilteredClone(lastActiveChannel, lastMessage)", function () {
+ it("should send empty user list", function () {
const chan = new Chan();
chan.setUser(new User({nick: "test"}));
expect(chan.getFilteredClone().users).to.be.empty;
});
- it("should keep necessary properties", function() {
+ it("should keep necessary properties", function () {
const chan = new Chan();
expect(chan.getFilteredClone())
@@ -223,7 +223,7 @@ describe("Chan", function() {
);
});
- it("should send only last message for non active channel", function() {
+ it("should send only last message for non active channel", function () {
const chan = new Chan({
id: 1337,
messages: [
@@ -242,7 +242,7 @@ describe("Chan", function() {
expect(messages[0].id).to.equal(13);
});
- it("should send more messages for active channel", function() {
+ it("should send more messages for active channel", function () {
const chan = new Chan({
id: 1337,
messages: [
@@ -264,7 +264,7 @@ describe("Chan", function() {
expect(chan.getFilteredClone(true).messages).to.have.lengthOf(4);
});
- it("should only send new messages", function() {
+ it("should only send new messages", function () {
const chan = new Chan({
id: 1337,
messages: [
diff --git a/test/models/msg.js b/test/models/msg.js
index 70079a59..3c7d59b7 100644
--- a/test/models/msg.js
+++ b/test/models/msg.js
@@ -5,9 +5,9 @@ const expect = require("chai").expect;
const Msg = require("../../src/models/msg");
const User = require("../../src/models/user");
-describe("Msg", function() {
+describe("Msg", function () {
["from", "target"].forEach((prop) => {
- it(`should keep a copy of the original user in the \`${prop}\` property`, function() {
+ it(`should keep a copy of the original user in the \`${prop}\` property`, function () {
const prefixLookup = {a: "&", o: "@"};
const user = new User(
{
@@ -27,7 +27,7 @@ describe("Msg", function() {
});
});
- describe("#findPreview(link)", function() {
+ describe("#findPreview(link)", function () {
const msg = new Msg({
previews: [
{
@@ -49,11 +49,11 @@ describe("Msg", function() {
],
});
- it("should find a preview given an existing link", function() {
+ it("should find a preview given an existing link", function () {
expect(msg.findPreview("https://thelounge.chat/").head).to.equal("The Lounge");
});
- it("should not find a preview that does not exist", function() {
+ it("should not find a preview that does not exist", function () {
expect(msg.findPreview("https://github.com/thelounge/thelounge")).to.be.undefined;
});
});
diff --git a/test/models/network.js b/test/models/network.js
index a546a549..980bd58d 100644
--- a/test/models/network.js
+++ b/test/models/network.js
@@ -7,9 +7,9 @@ const User = require("../../src/models/user");
const Network = require("../../src/models/network");
const Helper = require("../../src/helper");
-describe("Network", function() {
- describe("#export()", function() {
- it("should produce an valid object", function() {
+describe("Network", function () {
+ describe("#export()", function () {
+ it("should produce an valid object", function () {
const network = new Network({
uuid: "hello world",
awayMessage: "I am away",
@@ -50,7 +50,7 @@ describe("Network", function() {
});
});
- it("validate should set correct defaults", function() {
+ it("validate should set correct defaults", function () {
Helper.config.defaults.nick = "";
const network = new Network({
@@ -71,7 +71,7 @@ describe("Network", function() {
expect(network2.username).to.equal("InvalidNick");
});
- it("lockNetwork should be enforced when validating", function() {
+ it("lockNetwork should be enforced when validating", function () {
Helper.config.lockNetwork = true;
// Make sure we lock in private mode
@@ -101,7 +101,7 @@ describe("Network", function() {
Helper.config.lockNetwork = false;
});
- it("editing a network should enforce correct types", function() {
+ it("editing a network should enforce correct types", function () {
let saveCalled = false;
const network = new Network();
@@ -151,7 +151,7 @@ describe("Network", function() {
]);
});
- it("should generate uuid (v4) for each network", function() {
+ it("should generate uuid (v4) for each network", function () {
const network1 = new Network();
const network2 = new Network();
@@ -160,7 +160,7 @@ describe("Network", function() {
expect(network1.uuid).to.not.equal(network2.uuid);
});
- it("lobby should be at the top", function() {
+ it("lobby should be at the top", function () {
const network = new Network({
name: "Super Nice Network",
channels: [
@@ -175,7 +175,7 @@ describe("Network", function() {
expect(network.channels[0].type).to.equal(Chan.Type.LOBBY);
});
- it("should maintain channel reference", function() {
+ it("should maintain channel reference", function () {
const chan = new Chan({
name: "#506-bug-fix",
messages: [
@@ -209,8 +209,8 @@ describe("Network", function() {
});
});
- describe("#getFilteredClone(lastActiveChannel, lastMessage)", function() {
- it("should filter channels", function() {
+ describe("#getFilteredClone(lastActiveChannel, lastMessage)", function () {
+ it("should filter channels", function () {
const chan = new Chan();
chan.setUser(new User({nick: "test"}));
@@ -221,7 +221,7 @@ describe("Network", function() {
expect(network.channels[0].users).to.be.empty;
});
- it("should keep necessary properties", function() {
+ it("should keep necessary properties", function () {
const network = new Network();
const clone = network.getFilteredClone();
@@ -229,14 +229,12 @@ describe("Network", function() {
.to.be.an("object")
.that.has.all.keys("channels", "status", "nick", "name", "serverOptions", "uuid");
- expect(clone.status)
- .to.be.an("object")
- .that.has.all.keys("connected", "secure");
+ expect(clone.status).to.be.an("object").that.has.all.keys("connected", "secure");
});
});
- describe("#addChannel(newChan)", function() {
- it("should add channel", function() {
+ describe("#addChannel(newChan)", function () {
+ it("should add channel", function () {
const chan = new Chan({name: "#thelounge"});
const network = new Network({
@@ -251,7 +249,7 @@ describe("Network", function() {
expect(network.channels.length).to.equal(3);
});
- it("should add channel alphabetically", function() {
+ it("should add channel alphabetically", function () {
const chan1 = new Chan({name: "#abc"});
const chan2 = new Chan({name: "#thelounge"});
const chan3 = new Chan({name: "#zero"});
@@ -271,7 +269,7 @@ describe("Network", function() {
expect(network.channels[4]).to.equal(chan3);
});
- it("should sort case-insensitively", function() {
+ it("should sort case-insensitively", function () {
const chan1 = new Chan({name: "#abc"});
const chan2 = new Chan({name: "#THELOUNGE"});
@@ -287,7 +285,7 @@ describe("Network", function() {
expect(network.channels[3]).to.equal(chan2);
});
- it("should sort users separately from channels", function() {
+ it("should sort users separately from channels", function () {
const chan1 = new Chan({name: "#abc"});
const chan2 = new Chan({name: "#THELOUNGE"});
@@ -303,7 +301,7 @@ describe("Network", function() {
expect(network.channels[3]).to.equal(newUser);
});
- it("should sort users alphabetically", function() {
+ it("should sort users alphabetically", function () {
const chan1 = new Chan({name: "#abc"});
const chan2 = new Chan({name: "#THELOUNGE"});
const user1 = new Chan({name: "astorije", type: Chan.Type.QUERY});
@@ -323,7 +321,7 @@ describe("Network", function() {
expect(network.channels[5]).to.equal(user2);
});
- it("should not sort special channels", function() {
+ it("should not sort special channels", function () {
const chan1 = new Chan({name: "#abc"});
const chan2 = new Chan({name: "#THELOUNGE"});
const user1 = new Chan({name: "astorije", type: Chan.Type.QUERY});
@@ -343,7 +341,7 @@ describe("Network", function() {
expect(network.channels[5]).to.equal(newBanlist);
});
- it("should not compare against special channels", function() {
+ it("should not compare against special channels", function () {
const chan1 = new Chan({name: "#abc"});
const chan2 = new Chan({name: "#THELOUNGE"});
const user1 = new Chan({name: "astorije", type: Chan.Type.QUERY});
@@ -364,7 +362,7 @@ describe("Network", function() {
expect(network.channels[5]).to.equal(newBanlist);
});
- it("should insert before first special channel", function() {
+ it("should insert before first special channel", function () {
const banlist = new Chan({name: "Banlist for #THELOUNGE", type: Chan.Type.SPECIAL});
const chan1 = new Chan({name: "#thelounge"});
const user1 = new Chan({name: "astorije", type: Chan.Type.QUERY});
@@ -382,7 +380,7 @@ describe("Network", function() {
expect(network.channels[4]).to.equal(user1);
});
- it("should never add something in front of the lobby", function() {
+ it("should never add something in front of the lobby", function () {
const network = new Network({
name: "freenode",
channels: [],
diff --git a/test/plugins/auth/ldap.js b/test/plugins/auth/ldap.js
index 484279b0..88f76365 100644
--- a/test/plugins/auth/ldap.js
+++ b/test/plugins/auth/ldap.js
@@ -43,8 +43,8 @@ function startLdapServer(callback) {
return next(new ldap.InsufficientAccessRightsError());
}
- Object.keys(authorizedUsers).forEach(function(dn) {
- server.bind(dn, function(req, res, next) {
+ Object.keys(authorizedUsers).forEach(function (dn) {
+ server.bind(dn, function (req, res, next) {
const bindDN = req.dn.toString();
const password = req.credentials;
@@ -58,7 +58,7 @@ function startLdapServer(callback) {
});
});
- server.search(searchConf.base, authorize, function(req, res) {
+ server.search(searchConf.base, authorize, function (req, res) {
const obj = {
dn: userDN,
attributes: {
@@ -89,18 +89,18 @@ function testLdapAuth() {
const manager = {};
const client = true;
- it("should successfully authenticate with correct password", function(done) {
- ldapAuth.auth(manager, client, user, correctPassword, function(valid) {
+ it("should successfully authenticate with correct password", function (done) {
+ ldapAuth.auth(manager, client, user, correctPassword, function (valid) {
expect(valid).to.equal(true);
done();
});
});
- it("should fail to authenticate with incorrect password", function(done) {
+ it("should fail to authenticate with incorrect password", function (done) {
let error = "";
stub(log, "error").callsFake(TestUtil.sanitizeLog((str) => (error += str)));
- ldapAuth.auth(manager, client, user, wrongPassword, function(valid) {
+ ldapAuth.auth(manager, client, user, wrongPassword, function (valid) {
expect(valid).to.equal(false);
expect(error).to.equal(
"LDAP bind failed: InsufficientAccessRightsError: InsufficientAccessRightsError\n"
@@ -110,11 +110,11 @@ function testLdapAuth() {
});
});
- it("should fail to authenticate with incorrect username", function(done) {
+ it("should fail to authenticate with incorrect username", function (done) {
let warning = "";
stub(log, "warn").callsFake(TestUtil.sanitizeLog((str) => (warning += str)));
- ldapAuth.auth(manager, client, wrongUser, correctPassword, function(valid) {
+ ldapAuth.auth(manager, client, wrongUser, correctPassword, function (valid) {
expect(valid).to.equal(false);
expect(warning).to.equal("LDAP Search did not find anything for: eve (0)\n");
log.warn.restore();
@@ -123,39 +123,39 @@ function testLdapAuth() {
});
}
-describe("LDAP authentication plugin", function() {
+describe("LDAP authentication plugin", function () {
// Increase timeout due to unpredictable I/O on CI services
this.timeout(TestUtil.isRunningOnCI() ? 25000 : 5000);
this.slow(300);
let server;
- before(function(done) {
+ before(function (done) {
stub(log, "info");
server = startLdapServer(done);
});
- after(function() {
+ after(function () {
server.close();
log.info.restore();
});
- beforeEach(function() {
+ beforeEach(function () {
Helper.config.public = false;
Helper.config.ldap.enable = true;
Helper.config.ldap.url = "ldap://localhost:" + String(serverPort);
Helper.config.ldap.primaryKey = primaryKey;
});
- afterEach(function() {
+ afterEach(function () {
Helper.config.public = true;
Helper.config.ldap.enable = false;
});
- describe("LDAP authentication availability", function() {
- it("checks that the configuration is correctly tied to isEnabled()", function() {
+ describe("LDAP authentication availability", function () {
+ it("checks that the configuration is correctly tied to isEnabled()", function () {
Helper.config.ldap.enable = true;
expect(ldapAuth.isEnabled()).to.equal(true);
@@ -164,12 +164,12 @@ describe("LDAP authentication plugin", function() {
});
});
- describe("Simple LDAP authentication (predefined DN pattern)", function() {
+ describe("Simple LDAP authentication (predefined DN pattern)", function () {
Helper.config.ldap.baseDN = baseDN;
testLdapAuth();
});
- describe("Advanced LDAP authentication (DN found by a prior search query)", function() {
+ describe("Advanced LDAP authentication (DN found by a prior search query)", function () {
delete Helper.config.ldap.baseDN;
testLdapAuth();
});
diff --git a/test/plugins/inputs/indexTest.js b/test/plugins/inputs/indexTest.js
index 56c2eef1..75cef0ba 100644
--- a/test/plugins/inputs/indexTest.js
+++ b/test/plugins/inputs/indexTest.js
@@ -3,17 +3,15 @@
const expect = require("chai").expect;
const inputs = require("../../../src/plugins/inputs");
-describe("inputs", function() {
- describe(".getCommands", function() {
- it("should return a non-empty array", function() {
+describe("inputs", function () {
+ describe(".getCommands", function () {
+ it("should return a non-empty array", function () {
expect(inputs.getCommands()).to.be.an("array").that.is.not.empty;
});
- it("should only return strings with no whitespaces and starting with /", function() {
+ it("should only return strings with no whitespaces and starting with /", function () {
inputs.getCommands().forEach((command) => {
- expect(command)
- .to.be.a("string")
- .that.does.not.match(/\s/);
+ expect(command).to.be.a("string").that.does.not.match(/\s/);
expect(command[0]).to.equal("/");
});
});
diff --git a/test/plugins/link.js b/test/plugins/link.js
index d995d43f..01dbe042 100644
--- a/test/plugins/link.js
+++ b/test/plugins/link.js
@@ -6,7 +6,7 @@ const util = require("../util");
const Helper = require("../../src/helper");
const link = require("../../src/plugins/irc-events/link.js");
-describe("Link plugin", function() {
+describe("Link plugin", function () {
// Increase timeout due to unpredictable I/O on CI services
this.timeout(util.isRunningOnCI() ? 25000 : 5000);
this.slow(300);
@@ -23,9 +23,9 @@ Vivamus bibendum vulputate tincidunt. Sed vitae ligula felis.`;
let app;
- beforeEach(function(done) {
+ beforeEach(function (done) {
app = util.createWebserver();
- app.get("/real-test-image.png", function(req, res) {
+ app.get("/real-test-image.png", function (req, res) {
res.sendFile(path.resolve(__dirname, "../../client/img/logo-grey-bg-120x120px.png"));
});
this.connection = app.listen(0, () => {
@@ -39,11 +39,11 @@ Vivamus bibendum vulputate tincidunt. Sed vitae ligula felis.`;
Helper.config.prefetchStorage = false;
});
- afterEach(function(done) {
+ afterEach(function (done) {
this.connection.close(done);
});
- it("should be able to fetch basic information about URLs", function(done) {
+ it("should be able to fetch basic information about URLs", function (done) {
const url = "http://localhost:" + this.port + "/basic";
const message = this.irc.createMessage({
text: url,
@@ -63,13 +63,13 @@ Vivamus bibendum vulputate tincidunt. Sed vitae ligula felis.`;
},
]);
- app.get("/basic", function(req, res) {
+ app.get("/basic", function (req, res) {
res.send(
"test title"
);
});
- this.irc.once("msg:preview", function(data) {
+ this.irc.once("msg:preview", function (data) {
expect(data.preview.type).to.equal("link");
expect(data.preview.head).to.equal("test title");
expect(data.preview.body).to.equal("simple description");
@@ -80,7 +80,7 @@ Vivamus bibendum vulputate tincidunt. Sed vitae ligula felis.`;
});
});
- it("should be able to display body for text/plain", function(done) {
+ it("should be able to display body for text/plain", function (done) {
const url = "http://localhost:" + this.port + "/basic-text";
const message = this.irc.createMessage({
text: url,
@@ -100,11 +100,11 @@ Vivamus bibendum vulputate tincidunt. Sed vitae ligula felis.`;
},
]);
- app.get("/basic-text", function(req, res) {
+ app.get("/basic-text", function (req, res) {
res.type("text").send(loremIpsum);
});
- this.irc.once("msg:preview", function(data) {
+ this.irc.once("msg:preview", function (data) {
expect(data.preview.type).to.equal("link");
expect(data.preview.head).to.equal("Untitled page");
expect(data.preview.body).to.equal(loremIpsum.substring(0, 300));
@@ -116,7 +116,7 @@ Vivamus bibendum vulputate tincidunt. Sed vitae ligula felis.`;
});
});
- it("should truncate head and body", function(done) {
+ it("should truncate head and body", function (done) {
const url = "http://localhost:" + this.port + "/truncate";
const message = this.irc.createMessage({
text: url,
@@ -124,13 +124,13 @@ Vivamus bibendum vulputate tincidunt. Sed vitae ligula felis.`;
link(this.irc, this.network.channels[0], message);
- app.get("/truncate", function(req, res) {
+ app.get("/truncate", function (req, res) {
res.send(
`${loremIpsum}`
);
});
- this.irc.once("msg:preview", function(data) {
+ this.irc.once("msg:preview", function (data) {
expect(data.preview.type).to.equal("link");
expect(data.preview.head).to.equal(loremIpsum.substring(0, 100));
expect(data.preview.body).to.equal(loremIpsum.substring(0, 300));
@@ -141,63 +141,63 @@ Vivamus bibendum vulputate tincidunt. Sed vitae ligula felis.`;
});
});
- it("should prefer og:title over title", function(done) {
+ it("should prefer og:title over title", function (done) {
const message = this.irc.createMessage({
text: "http://localhost:" + this.port + "/basic-og",
});
link(this.irc, this.network.channels[0], message);
- app.get("/basic-og", function(req, res) {
+ app.get("/basic-og", function (req, res) {
res.send("test");
});
- this.irc.once("msg:preview", function(data) {
+ this.irc.once("msg:preview", function (data) {
expect(data.preview.head).to.equal("opengraph test");
done();
});
});
- it("should find only the first matching tag", function(done) {
+ it("should find only the first matching tag", function (done) {
const message = this.irc.createMessage({
text: "http://localhost:" + this.port + "/duplicate-tags",
});
link(this.irc, this.network.channels[0], message);
- app.get("/duplicate-tags", function(req, res) {
+ app.get("/duplicate-tags", function (req, res) {
res.send(
"testmagnifying glass icon"
);
});
- this.irc.once("msg:preview", function(data) {
+ this.irc.once("msg:preview", function (data) {
expect(data.preview.head).to.equal("test");
expect(data.preview.body).to.equal("desc1");
done();
});
});
- it("should prefer og:description over description", function(done) {
+ it("should prefer og:description over description", function (done) {
const message = this.irc.createMessage({
text: "http://localhost:" + this.port + "/description-og",
});
link(this.irc, this.network.channels[0], message);
- app.get("/description-og", function(req, res) {
+ app.get("/description-og", function (req, res) {
res.send(
""
);
});
- this.irc.once("msg:preview", function(data) {
+ this.irc.once("msg:preview", function (data) {
expect(data.preview.body).to.equal("opengraph description");
done();
});
});
- it("should find og:image with full url", function(done) {
+ it("should find og:image with full url", function (done) {
const port = this.port;
const message = this.irc.createMessage({
text: "http://localhost:" + this.port + "/thumb",
@@ -205,7 +205,7 @@ Vivamus bibendum vulputate tincidunt. Sed vitae ligula felis.`;
link(this.irc, this.network.channels[0], message);
- app.get("/thumb", function(req, res) {
+ app.get("/thumb", function (req, res) {
res.send(
"Google"
);
});
- this.irc.once("msg:preview", function(data) {
+ this.irc.once("msg:preview", function (data) {
expect(data.preview.thumb).to.equal(
"http://localhost:" + port + "/real-test-image.png"
);
@@ -244,7 +244,7 @@ Vivamus bibendum vulputate tincidunt. Sed vitae ligula felis.`;
});
});
- it("should correctly resolve relative protocol", function(done) {
+ it("should correctly resolve relative protocol", function (done) {
const port = this.port;
const message = this.irc.createMessage({
text: "http://localhost:" + this.port + "/thumb-image-src",
@@ -252,11 +252,11 @@ Vivamus bibendum vulputate tincidunt. Sed vitae ligula felis.`;
link(this.irc, this.network.channels[0], message);
- app.get("/thumb-image-src", function(req, res) {
+ app.get("/thumb-image-src", function (req, res) {
res.send("");
});
- this.irc.once("msg:preview", function(data) {
+ this.irc.once("msg:preview", function (data) {
expect(data.preview.thumb).to.equal(
"http://localhost:" + port + "/real-test-image.png"
);
@@ -264,7 +264,7 @@ Vivamus bibendum vulputate tincidunt. Sed vitae ligula felis.`;
});
});
- it("should resolve url correctly for relative url", function(done) {
+ it("should resolve url correctly for relative url", function (done) {
const port = this.port;
const message = this.irc.createMessage({
text: "http://localhost:" + this.port + "/relative-thumb",
@@ -272,13 +272,13 @@ Vivamus bibendum vulputate tincidunt. Sed vitae ligula felis.`;
link(this.irc, this.network.channels[0], message);
- app.get("/relative-thumb", function(req, res) {
+ app.get("/relative-thumb", function (req, res) {
res.send(
"test relative image"
);
});
- this.irc.once("msg:preview", function(data) {
+ this.irc.once("msg:preview", function (data) {
expect(data.preview.thumb).to.equal(
"http://localhost:" + port + "/real-test-image.png"
);
@@ -288,7 +288,7 @@ Vivamus bibendum vulputate tincidunt. Sed vitae ligula felis.`;
});
});
- it("should send untitled page if there is a thumbnail", function(done) {
+ it("should send untitled page if there is a thumbnail", function (done) {
const port = this.port;
const message = this.irc.createMessage({
text: "http://localhost:" + this.port + "/thumb-no-title",
@@ -296,7 +296,7 @@ Vivamus bibendum vulputate tincidunt. Sed vitae ligula felis.`;
link(this.irc, this.network.channels[0], message);
- app.get("/thumb-no-title", function(req, res) {
+ app.get("/thumb-no-title", function (req, res) {
res.send(
"");
});
- this.irc.once("msg:preview", function(data) {
+ this.irc.once("msg:preview", function (data) {
expect(data.preview.head).to.equal("Untitled page");
expect(data.preview.body).to.equal("hello world");
expect(data.preview.thumb).to.equal("");
@@ -335,7 +335,7 @@ Vivamus bibendum vulputate tincidunt. Sed vitae ligula felis.`;
});
});
- it("should not send thumbnail if image is 404", function(done) {
+ it("should not send thumbnail if image is 404", function (done) {
const port = this.port;
const message = this.irc.createMessage({
text: "http://localhost:" + this.port + "/thumb-404",
@@ -343,7 +343,7 @@ Vivamus bibendum vulputate tincidunt. Sed vitae ligula felis.`;
link(this.irc, this.network.channels[0], message);
- app.get("/thumb-404", function(req, res) {
+ app.get("/thumb-404", function (req, res) {
res.send(
"404 image404 image link(this.irc, this.network.channels[0], message));
- app.get("/basic-og-once", function(req, res) {
+ app.get("/basic-og-once", function (req, res) {
requests++;
expect(req.header("accept-language")).to.equal("very nice language");
@@ -665,7 +665,7 @@ Vivamus bibendum vulputate tincidunt. Sed vitae ligula felis.`;
this.irc.on("msg:preview", cb);
});
- it("should fetch same link with different languages multiple times", function(done) {
+ it("should fetch same link with different languages multiple times", function (done) {
const message = this.irc.createMessage({
text: "http://localhost:" + this.port + "/basic-og-once-lang",
});
@@ -681,7 +681,7 @@ Vivamus bibendum vulputate tincidunt. Sed vitae ligula felis.`;
link(this.irc, this.network.channels[0], message);
}, 100);
- app.get("/basic-og-once-lang", function(req, res) {
+ app.get("/basic-og-once-lang", function (req, res) {
requests.push(req.header("accept-language"));
// delay the request so it doesn't resolve immediately
diff --git a/test/plugins/packages/indexTest.js b/test/plugins/packages/indexTest.js
index 4e149a9c..3f1d7383 100644
--- a/test/plugins/packages/indexTest.js
+++ b/test/plugins/packages/indexTest.js
@@ -7,44 +7,44 @@ const TestUtil = require("../../util");
let packages;
-describe("packages", function() {
- beforeEach(function() {
+describe("packages", function () {
+ beforeEach(function () {
stub(log, "info");
delete require.cache[require.resolve("../../../src/plugins/packages")];
packages = require("../../../src/plugins/packages");
});
- afterEach(function() {
+ afterEach(function () {
log.info.restore();
});
- describe(".getStylesheets", function() {
- it("should contain no stylesheets before packages are loaded", function() {
+ describe(".getStylesheets", function () {
+ it("should contain no stylesheets before packages are loaded", function () {
expect(packages.getStylesheets()).to.be.empty;
});
- it("should return the list of registered stylesheets for loaded packages", function() {
+ it("should return the list of registered stylesheets for loaded packages", function () {
packages.loadPackages();
expect(packages.getStylesheets()).to.deep.equal(["thelounge-package-foo/style.css"]);
});
});
- describe(".getPackage", function() {
- it("should contain no reference to packages before loading them", function() {
+ describe(".getPackage", function () {
+ it("should contain no reference to packages before loading them", function () {
expect(packages.getPackage("thelounge-package-foo")).to.be.undefined;
});
- it("should return details of a registered package after it was loaded", function() {
+ it("should return details of a registered package after it was loaded", function () {
packages.loadPackages();
expect(packages.getPackage("thelounge-package-foo")).to.have.key("onServerStart");
});
});
- describe(".loadPackages", function() {
- it("should display report about loading packages", function() {
+ describe(".loadPackages", function () {
+ it("should display report about loading packages", function () {
// Mock `log.info` to extract its effect into a string
log.info.restore();
let stdout = "";
diff --git a/test/plugins/sqlite.js b/test/plugins/sqlite.js
index 90f07040..2826d784 100644
--- a/test/plugins/sqlite.js
+++ b/test/plugins/sqlite.js
@@ -8,7 +8,7 @@ const Msg = require("../../src/models/msg");
const Helper = require("../../src/helper");
const MessageStorage = require("../../src/plugins/messageStorage/sqlite.js");
-describe("SQLite Message Storage", function() {
+describe("SQLite Message Storage", function () {
// Increase timeout due to unpredictable I/O on CI services
this.timeout(util.isRunningOnCI() ? 25000 : 5000);
this.slow(300);
@@ -17,7 +17,7 @@ describe("SQLite Message Storage", function() {
let store;
// Delete database file from previous test run
- before(function(done) {
+ before(function (done) {
store = new MessageStorage({
name: "testUser",
idMsg: 1,
@@ -30,14 +30,14 @@ describe("SQLite Message Storage", function() {
}
});
- it("should resolve an empty array when disabled", function(done) {
+ it("should resolve an empty array when disabled", function (done) {
store.getMessages(null, null).then((messages) => {
expect(messages).to.be.empty;
done();
});
});
- it("should create database file", function() {
+ it("should create database file", function () {
expect(store.isEnabled).to.be.false;
expect(fs.existsSync(expectedPath)).to.be.false;
@@ -46,7 +46,7 @@ describe("SQLite Message Storage", function() {
expect(store.isEnabled).to.be.true;
});
- it("should create tables", function(done) {
+ it("should create tables", function (done) {
store.database.serialize(() =>
store.database.all(
"SELECT name, tbl_name, sql FROM sqlite_master WHERE type = 'table'",
@@ -73,7 +73,7 @@ describe("SQLite Message Storage", function() {
);
});
- it("should insert schema version to options table", function(done) {
+ it("should insert schema version to options table", function (done) {
store.database.serialize(() =>
store.database.get(
"SELECT value FROM options WHERE name = 'schema_version'",
@@ -90,7 +90,7 @@ describe("SQLite Message Storage", function() {
);
});
- it("should store a message", function(done) {
+ it("should store a message", function (done) {
store.database.serialize(() => {
store.index(
{
@@ -109,7 +109,7 @@ describe("SQLite Message Storage", function() {
});
});
- it("should retrieve previously stored message", function(done) {
+ it("should retrieve previously stored message", function (done) {
store.database.serialize(() =>
store
.getMessages(
@@ -134,7 +134,7 @@ describe("SQLite Message Storage", function() {
);
});
- it("should close database", function(done) {
+ it("should close database", function (done) {
store.close((err) => {
expect(err).to.be.null;
expect(fs.existsSync(expectedPath)).to.be.true;
diff --git a/test/plugins/storage.js b/test/plugins/storage.js
index 378a917b..145e7c70 100644
--- a/test/plugins/storage.js
+++ b/test/plugins/storage.js
@@ -8,7 +8,7 @@ const util = require("../util");
const Helper = require("../../src/helper");
const link = require("../../src/plugins/irc-events/link.js");
-describe("Image storage", function() {
+describe("Image storage", function () {
// Increase timeout due to unpredictable I/O on CI services
this.timeout(util.isRunningOnCI() ? 25000 : 5000);
this.slow(300);
@@ -33,12 +33,12 @@ describe("Image storage", function() {
4
)}/${correctSvgHash.substring(4)}.svg`;
- before(function(done) {
+ before(function (done) {
this.app = util.createWebserver();
- this.app.get("/real-test-image.png", function(req, res) {
+ this.app.get("/real-test-image.png", function (req, res) {
res.sendFile(testImagePath);
});
- this.app.get("/logo.svg", function(req, res) {
+ this.app.get("/logo.svg", function (req, res) {
res.sendFile(testSvgPath);
});
this.connection = this.app.listen(0, () => {
@@ -47,22 +47,22 @@ describe("Image storage", function() {
});
});
- after(function(done) {
+ after(function (done) {
this.connection.close(done);
});
- beforeEach(function() {
+ beforeEach(function () {
this.irc = util.createClient();
this.network = util.createNetwork();
Helper.config.prefetchStorage = true;
});
- afterEach(function() {
+ afterEach(function () {
Helper.config.prefetchStorage = false;
});
- it("should store the thumbnail", function(done) {
+ it("should store the thumbnail", function (done) {
const port = this.port;
const message = this.irc.createMessage({
text: "http://localhost:" + port + "/thumb",
@@ -70,7 +70,7 @@ describe("Image storage", function() {
link(this.irc, this.network.channels[0], message);
- this.app.get("/thumb", function(req, res) {
+ this.app.get("/thumb", function (req, res) {
res.send(
"Google (warning += str)));
diff --git a/test/src/helperTest.js b/test/src/helperTest.js
index 0eb827c5..c1b4b0fe 100644
--- a/test/src/helperTest.js
+++ b/test/src/helperTest.js
@@ -4,53 +4,53 @@ const expect = require("chai").expect;
const os = require("os");
const Helper = require("../../src/helper");
-describe("Helper", function() {
- describe("#expandHome", function() {
- it("should correctly expand a Unix path", function() {
+describe("Helper", function () {
+ describe("#expandHome", function () {
+ it("should correctly expand a Unix path", function () {
expect([`${os.homedir()}/tmp`, `${os.homedir()}\\tmp`]).to.include(
Helper.expandHome("~/tmp")
);
});
- it("should correctly expand a Windows path", function() {
+ it("should correctly expand a Windows path", function () {
expect(Helper.expandHome("~\\tmp")).to.equal(`${os.homedir()}\\tmp`);
});
- it("should correctly expand when not given a specific path", function() {
+ it("should correctly expand when not given a specific path", function () {
expect(Helper.expandHome("~")).to.equal(os.homedir());
});
- it("should not expand paths not starting with tilde", function() {
+ it("should not expand paths not starting with tilde", function () {
expect(Helper.expandHome("/tmp")).to.match(/^\/tmp|[a-zA-Z]:\\{1,2}tmp$/);
});
- it("should not expand a tilde in the middle of a string", function() {
+ it("should not expand a tilde in the middle of a string", function () {
expect(Helper.expandHome("/tmp/~foo")).to.match(
/^\/tmp\/~foo|[a-zA-Z]:\\{1,2}?tmp\\{1,2}~foo$/
);
});
- it("should return an empty string when given an empty string", function() {
+ it("should return an empty string when given an empty string", function () {
expect(Helper.expandHome("")).to.equal("");
});
- it("should return an empty string when given undefined", function() {
+ it("should return an empty string when given undefined", function () {
expect(Helper.expandHome(undefined)).to.equal("");
});
});
- describe("#getVersion()", function() {
+ describe("#getVersion()", function () {
const version = Helper.getVersion();
- it("should mention it is served from source code", function() {
+ it("should mention it is served from source code", function () {
expect(version).to.include("source");
});
- it("should include a short Git SHA", function() {
+ it("should include a short Git SHA", function () {
expect(version).to.match(/\([0-9a-f]{7,11} /);
});
- it("should include a valid semver version", function() {
+ it("should include a valid semver version", function () {
expect(version).to.match(/v[0-9]+\.[0-9]+\.[0-9]+/);
});
});
diff --git a/test/tests/build.js b/test/tests/build.js
index acc8c69a..f13674c6 100644
--- a/test/tests/build.js
+++ b/test/tests/build.js
@@ -4,38 +4,38 @@ const expect = require("chai").expect;
const fs = require("fs");
const path = require("path");
-describe("public folder", function() {
+describe("public folder", function () {
const publicFolder = path.join(__dirname, "..", "..", "public");
- it("font awesome files are copied", function() {
+ it("font awesome files are copied", function () {
expect(fs.existsSync(path.join(publicFolder, "fonts", "fa-solid-900.woff"))).to.be.true;
expect(fs.existsSync(path.join(publicFolder, "fonts", "fa-solid-900.woff2"))).to.be.true;
});
- it("files in root folder are copied", function() {
+ it("files in root folder are copied", function () {
expect(fs.existsSync(path.join(publicFolder, "favicon.ico"))).to.be.true;
expect(fs.existsSync(path.join(publicFolder, "robots.txt"))).to.be.true;
expect(fs.existsSync(path.join(publicFolder, "service-worker.js"))).to.be.true;
expect(fs.existsSync(path.join(publicFolder, "thelounge.webmanifest"))).to.be.true;
});
- it("index HTML file is not copied", function() {
+ it("index HTML file is not copied", function () {
expect(fs.existsSync(path.join(publicFolder, "index.html"))).to.be.false;
expect(fs.existsSync(path.join(publicFolder, "index.html.tpl"))).to.be.false;
});
- it("javascript files are built", function() {
+ it("javascript files are built", function () {
expect(fs.existsSync(path.join(publicFolder, "js", "bundle.js"))).to.be.true;
expect(fs.existsSync(path.join(publicFolder, "js", "bundle.vendor.js"))).to.be.true;
});
- it("style files are built", function() {
+ it("style files are built", function () {
expect(fs.existsSync(path.join(publicFolder, "css", "style.css"))).to.be.true;
expect(fs.existsSync(path.join(publicFolder, "css", "style.css.map"))).to.be.true;
});
- it("style files contain expected content", function(done) {
- fs.readFile(path.join(publicFolder, "css", "style.css"), "utf8", function(err, contents) {
+ it("style files contain expected content", function (done) {
+ fs.readFile(path.join(publicFolder, "css", "style.css"), "utf8", function (err, contents) {
expect(err).to.be.null;
expect(contents.includes("var(--body-color)")).to.be.true;
@@ -47,11 +47,11 @@ describe("public folder", function() {
});
});
- it("javascript map is created", function() {
+ it("javascript map is created", function () {
expect(fs.existsSync(path.join(publicFolder, "js", "bundle.js.map"))).to.be.true;
});
- it("loading-error-handlers.js is copied", function() {
+ it("loading-error-handlers.js is copied", function () {
expect(fs.existsSync(path.join(publicFolder, "js", "loading-error-handlers.js"))).to.be
.true;
});
diff --git a/test/tests/customhighlights.js b/test/tests/customhighlights.js
index a151fef8..86aa3883 100644
--- a/test/tests/customhighlights.js
+++ b/test/tests/customhighlights.js
@@ -6,7 +6,7 @@ const log = require("../../src/log");
const Client = require("../../src/client");
const TestUtil = require("../util");
-describe("Custom highlights", function() {
+describe("Custom highlights", function () {
let userLoadedLog = "";
stub(log, "info").callsFake(TestUtil.sanitizeLog((str) => (userLoadedLog += str)));
@@ -29,7 +29,7 @@ describe("Custom highlights", function() {
log.info.restore();
expect(userLoadedLog).to.equal("User test loaded\n");
- it("should NOT highlight", function() {
+ it("should NOT highlight", function () {
const teststrings = [
"and foos stuff",
"test foobar",
@@ -47,7 +47,7 @@ describe("Custom highlights", function() {
}
});
- it("should highlight", function() {
+ it("should highlight", function () {
const teststrings = [
"Hey foo hello",
"hey Foo: hi",
@@ -82,11 +82,11 @@ describe("Custom highlights", function() {
}
});
- it("should trim custom highlights in the compiled regex", function() {
+ it("should trim custom highlights in the compiled regex", function () {
expect(client.highlightRegex).to.match(/\(\?:foo\|@all\|sp ace\|고\)/);
});
- it("should NOT compile a regex", function() {
+ it("should NOT compile a regex", function () {
// test updating the regex and invalid custom hl inputs
client.config.clientSettings.highlights = ",,";
client.compileCustomHighlights();
diff --git a/test/tests/hexip.js b/test/tests/hexip.js
index 255903c3..84b00b5f 100644
--- a/test/tests/hexip.js
+++ b/test/tests/hexip.js
@@ -3,14 +3,14 @@
const expect = require("chai").expect;
const Helper = require("../../src/helper");
-describe("HexIP", function() {
- it("should correctly convert IPv4 to hex", function() {
+describe("HexIP", function () {
+ it("should correctly convert IPv4 to hex", function () {
expect(Helper.ip2hex("66.124.160.150")).to.equal("427ca096");
expect(Helper.ip2hex("127.0.0.1")).to.equal("7f000001");
expect(Helper.ip2hex("0.0.0.255")).to.equal("000000ff");
});
- it("unsupported addresses return default", function() {
+ it("unsupported addresses return default", function () {
expect(Helper.ip2hex("0.0.0.999")).to.equal("00000000");
expect(Helper.ip2hex("localhost")).to.equal("00000000");
expect(Helper.ip2hex("::1")).to.equal("00000000");
diff --git a/test/tests/hostmask.js b/test/tests/hostmask.js
index 2c215643..406238c2 100644
--- a/test/tests/hostmask.js
+++ b/test/tests/hostmask.js
@@ -3,8 +3,8 @@
const expect = require("chai").expect;
const Helper = require("../../src/helper");
-describe("Hostmask", function() {
- it(".parseHostmask", function() {
+describe("Hostmask", function () {
+ it(".parseHostmask", function () {
expect(Helper.parseHostmask("nick").nick).to.equal("nick");
expect(Helper.parseHostmask("nick").ident).to.equal("*");
expect(Helper.parseHostmask("nick").hostname).to.equal("*");
@@ -46,14 +46,14 @@ describe("Hostmask", function() {
expect(Helper.parseHostmask("NiCK!uSEr@HOST").hostname).to.equal("host");
});
- it(".compareHostmask (wildcard)", function() {
+ it(".compareHostmask (wildcard)", function () {
const a = Helper.parseHostmask("nick!user@host");
const b = Helper.parseHostmask("nick!*@*");
expect(Helper.compareHostmask(b, a)).to.be.true;
expect(Helper.compareHostmask(a, b)).to.be.false;
});
- it(".compareHostmask", function() {
+ it(".compareHostmask", function () {
const a = Helper.parseHostmask("nick!user@host");
const b = Helper.parseHostmask("NiCK!useR@HOST");
expect(Helper.compareHostmask(b, a)).to.be.true;
diff --git a/test/tests/mergeConfig.js b/test/tests/mergeConfig.js
index f2ddb449..f50d2ffc 100644
--- a/test/tests/mergeConfig.js
+++ b/test/tests/mergeConfig.js
@@ -6,8 +6,8 @@ const stub = require("sinon").stub;
const mergeConfig = require("../../src/helper").mergeConfig;
const TestUtil = require("../util");
-describe("mergeConfig", function() {
- it("should mutate object", function() {
+describe("mergeConfig", function () {
+ it("should mutate object", function () {
const config = {
ip: "default",
};
@@ -25,7 +25,7 @@ describe("mergeConfig", function() {
});
});
- it("should merge new properties", function() {
+ it("should merge new properties", function () {
expect(
mergeConfig(
{
@@ -42,7 +42,7 @@ describe("mergeConfig", function() {
});
});
- it("should extend objects", function() {
+ it("should extend objects", function () {
expect(
mergeConfig(
{
@@ -63,7 +63,7 @@ describe("mergeConfig", function() {
});
});
- it("should warn for unknown top level keys", function() {
+ it("should warn for unknown top level keys", function () {
let warning = "";
stub(log, "warn").callsFake(TestUtil.sanitizeLog((str) => (warning += str)));
@@ -86,7 +86,7 @@ describe("mergeConfig", function() {
expect(warning).to.equal('Unknown key "optionTwo", please verify your config.\n');
});
- it("should not warn for unknown second level keys", function() {
+ it("should not warn for unknown second level keys", function () {
expect(
mergeConfig(
{
@@ -109,7 +109,7 @@ describe("mergeConfig", function() {
});
});
- it("should allow changing nulls", function() {
+ it("should allow changing nulls", function () {
expect(
mergeConfig(
{
@@ -124,7 +124,7 @@ describe("mergeConfig", function() {
});
});
- it("should allow changing nulls with objects", function() {
+ it("should allow changing nulls with objects", function () {
expect(
mergeConfig(
{
@@ -145,7 +145,7 @@ describe("mergeConfig", function() {
});
});
- it("should allow changing nulls with objects that has function", function() {
+ it("should allow changing nulls with objects that has function", function () {
const callbackFunction = () => ({});
expect(
@@ -166,7 +166,7 @@ describe("mergeConfig", function() {
});
});
- it("should keep new properties inside of objects", function() {
+ it("should keep new properties inside of objects", function () {
expect(
mergeConfig(
{
@@ -204,7 +204,7 @@ describe("mergeConfig", function() {
});
});
- it("should not merge arrays", function() {
+ it("should not merge arrays", function () {
expect(
mergeConfig(
{
@@ -232,7 +232,7 @@ describe("mergeConfig", function() {
});
});
- it("should change order in arrays", function() {
+ it("should change order in arrays", function () {
expect(
mergeConfig(
{
@@ -247,7 +247,7 @@ describe("mergeConfig", function() {
});
});
- it("should only merge same type", function() {
+ it("should only merge same type", function () {
stub(log, "warn");
expect(
diff --git a/test/tests/nickhighlights.js b/test/tests/nickhighlights.js
index 51b20989..06862c86 100644
--- a/test/tests/nickhighlights.js
+++ b/test/tests/nickhighlights.js
@@ -6,8 +6,8 @@ const Network = require("../../src/models/network");
const network = new Network({name: "networkName"});
-describe("Nickname highlights", function() {
- it("should NOT highlight nickname", function() {
+describe("Nickname highlights", function () {
+ it("should NOT highlight nickname", function () {
network.setNick("lounge-bot");
expect("").to.not.match(network.highlightRegex);
@@ -27,7 +27,7 @@ describe("Nickname highlights", function() {
expect("lounge-botW").to.not.match(network.highlightRegex);
});
- it("should highlight nickname", function() {
+ it("should highlight nickname", function () {
network.setNick("lounge-bot");
expect("lounge-bot").to.match(network.highlightRegex);
@@ -49,7 +49,7 @@ describe("Nickname highlights", function() {
expect("LOUNGE-bot|sleep, hey").to.match(network.highlightRegex);
});
- it("changing name should update regex", function() {
+ it("changing name should update regex", function () {
network.setNick("lounge-bot");
expect("lounge-bot, hello").to.match(network.highlightRegex);
diff --git a/test/tests/passwords.js b/test/tests/passwords.js
index f983a096..f899f908 100644
--- a/test/tests/passwords.js
+++ b/test/tests/passwords.js
@@ -3,12 +3,12 @@
const expect = require("chai").expect;
const Helper = require("../../src/helper");
-describe("Client passwords", function() {
+describe("Client passwords", function () {
this.slow(1500);
const inputPassword = "my$Super@Cool Password";
- it("hashed password should match", function() {
+ it("hashed password should match", function () {
// Generated with third party tool to test implementation
const comparedPassword = Helper.password.compare(
inputPassword,
@@ -20,7 +20,7 @@ describe("Client passwords", function() {
});
});
- it("wrong hashed password should not match", function() {
+ it("wrong hashed password should not match", function () {
// Compare against a fake hash
const comparedPassword = Helper.password.compare(
inputPassword,
@@ -32,7 +32,7 @@ describe("Client passwords", function() {
});
});
- it("freshly hashed password should match", function() {
+ it("freshly hashed password should match", function () {
const hashedPassword = Helper.password.hash(inputPassword);
const comparedPassword = Helper.password.compare(inputPassword, hashedPassword);
@@ -41,7 +41,7 @@ describe("Client passwords", function() {
});
});
- it("shout passwords should be marked as old", function() {
+ it("shout passwords should be marked as old", function () {
expect(
Helper.password.requiresUpdate(
"$2a$08$K4l.hteJcCP9D1G5PANzYuBGvdqhUSUDOLQLU.xeRxTbvtp01KINm"
diff --git a/test/tests/textLogFolder.js b/test/tests/textLogFolder.js
index c8a5ff9b..e00d7839 100644
--- a/test/tests/textLogFolder.js
+++ b/test/tests/textLogFolder.js
@@ -3,8 +3,8 @@
const expect = require("chai").expect;
const TextFileMessageStorage = require("../../src/plugins/messageStorage/text");
-describe("TextFileMessageStorage", function() {
- it("should combine network name and uuid into a safe name", function() {
+describe("TextFileMessageStorage", function () {
+ it("should combine network name and uuid into a safe name", function () {
expect(
TextFileMessageStorage.getNetworkFolderName({
name: "Freenode",
@@ -13,7 +13,7 @@ describe("TextFileMessageStorage", function() {
).to.equal("freenode-4016-45e0-a8a8-d378fb252628");
});
- it("network name should be cleaned up and lowercased", function() {
+ it("network name should be cleaned up and lowercased", function () {
expect(
TextFileMessageStorage.getNetworkFolderName({
name: '@ TeSt ../..\\<>:"/\\|?*',
@@ -22,7 +22,7 @@ describe("TextFileMessageStorage", function() {
).to.equal("@-test-.._..--45e0-a8a8-d378fb252628");
});
- it("folder name may contain two dashes if on boundary", function() {
+ it("folder name may contain two dashes if on boundary", function () {
expect(
TextFileMessageStorage.getNetworkFolderName({
name: "Freenod",
@@ -31,7 +31,7 @@ describe("TextFileMessageStorage", function() {
).to.equal("freenod--4016-45e0-a8a8-d378fb252628");
});
- it("should limit network name length", function() {
+ it("should limit network name length", function () {
expect(
TextFileMessageStorage.getNetworkFolderName({
name: "This network name is longer than the uuid itself but it should be limited",
diff --git a/test/util.js b/test/util.js
index 85e73d1e..c33f32a9 100644
--- a/test/util.js
+++ b/test/util.js
@@ -15,7 +15,7 @@ function MockClient() {
util.inherits(MockClient, EventEmitter);
-MockClient.prototype.createMessage = function(opts) {
+MockClient.prototype.createMessage = function (opts) {
const message = _.extend(
{
text: "dummy message",
@@ -30,7 +30,7 @@ MockClient.prototype.createMessage = function(opts) {
};
function sanitizeLog(callback) {
- return function(...args) {
+ return function (...args) {
// Concats and removes ANSI colors. See https://stackoverflow.com/a/29497680
const stdout = args
.join(" ")