Comply with ESLint

This commit is contained in:
William Boman 2015-10-01 00:39:57 +02:00
parent a69992f6b2
commit 8fdfd70c7e
40 changed files with 164 additions and 175 deletions

View file

@ -35,11 +35,12 @@ $(function() {
$("html").addClass("web-app-mode");
}
var pop;
try {
var pop = new Audio();
pop = new Audio();
pop.src = "/audio/pop.ogg";
} catch(e) {
var pop = {
} catch (e) {
pop = {
play: $.noop
};
}
@ -73,7 +74,7 @@ $(function() {
});
});
socket.on("auth", function(data) {
socket.on("auth", function(/* data */) {
var body = $("body");
var login = $("#sign-in");
if (!login.length) {
@ -183,7 +184,7 @@ $(function() {
socket.on("msg", function(data) {
var target = "#chan-" + data.chan;
if (data.msg.type == "error") {
if (data.msg.type === "error") {
target = "#chan-" + chat.find(".active").data("id");
}
@ -202,7 +203,7 @@ $(function() {
}
var type = data.msg.type;
if (type == "message" || type == "action") {
if (type === "message" || type === "action") {
var nicks = chan.find(".users").data("nicks");
if (nicks) {
var find = nicks.indexOf(from);
@ -220,7 +221,7 @@ $(function() {
.find(".messages")
.prepend(render("msg", {messages: data.messages}))
.end();
if (data.messages.length != 100) {
if (data.messages.length !== 100) {
chan.find(".show-more").removeClass("show");
}
});
@ -274,7 +275,7 @@ $(function() {
});
if (next !== null) {
var id = next.data("id");
id = next.data("id");
sidebar.find("[data-id=" + id + "]").click();
} else {
sidebar.find(".chan")
@ -374,7 +375,7 @@ $(function() {
].indexOf(name) !== -1) {
chat.toggleClass("hide-" + name, !self.prop("checked"));
}
if (name == "colors") {
if (name === "colors") {
chat.toggleClass("no-colors", !self.prop("checked"));
}
}).find("input")
@ -383,7 +384,7 @@ $(function() {
$("#badge").on("change", function() {
var self = $(this);
if (self.prop("checked")) {
if (Notification.permission != "granted") {
if (Notification.permission !== "granted") {
Notification.requestPermission();
}
}
@ -407,7 +408,6 @@ $(function() {
.tab(complete, {hint: false});
var form = $("#form");
var submit = $("#submit");
form.on("submit", function(e) {
e.preventDefault();
@ -428,7 +428,7 @@ $(function() {
var text = "";
if (window.getSelection) {
text = window.getSelection().toString();
} else if (document.selection && document.selection.type != "Control") {
} else if (document.selection && document.selection.type !== "Control") {
text = document.selection.createRange().text;
}
if (!text) {
@ -580,7 +580,7 @@ $(function() {
pop.play();
}
favico.badge("!");
if (settings.badge && Notification.permission == "granted") {
if (settings.badge && Notification.permission === "granted") {
var notify = new Notification(msg.from + " says:", {
body: msg.text.trim(),
icon: "/img/logo-64.png"
@ -640,7 +640,7 @@ $(function() {
var content = self.parent().next(".toggle-content");
if (bottom && !content.hasClass("show")) {
var img = content.find("img");
if (img.length != 0 && !img.width()) {
if (img.length !== 0 && !img.width()) {
img.on("load", function() {
chat.scrollBottom();
});
@ -678,7 +678,7 @@ $(function() {
form.find(".btn")
.attr("disabled", true)
.end();
if (form.closest(".window").attr("id") == "connect") {
if (form.closest(".window").attr("id") === "connect") {
event = "conn";
}
var values = {};
@ -732,8 +732,8 @@ $(function() {
Mousetrap.bind([
"command+k",
"ctrl+shift+l"
], function (e) {
if(e.target === input[0]) {
], function(e) {
if (e.target === input[0]) {
clear();
e.preventDefault();
}
@ -771,7 +771,7 @@ $(function() {
words.push(nicks[i]);
}
var channels = sidebar.find(".chan")
sidebar.find(".chan")
.each(function() {
var self = $(this);
if (!self.hasClass("lobby")) {
@ -875,7 +875,7 @@ $(function() {
}
array.splice(new_index, 0, array.splice(old_index, 1)[0]);
return array;
};
}
document.addEventListener(
"visibilitychange",

View file

@ -1,3 +1,3 @@
#!/usr/bin/env node
process.chdir(__dirname);
var cli = require("./src/command-line");
require("./src/command-line");

View file

@ -80,11 +80,11 @@ Client.prototype.emit = function(event, data) {
}
var config = this.config || {};
if (config.log === true) {
if (event == "msg") {
if (event === "msg") {
var target = this.find(data.chan);
if (target) {
var chan = target.chan.name;
if (target.chan.type == Chan.Type.LOBBY) {
if (target.chan.type === Chan.Type.LOBBY) {
chan = target.network.host;
}
log.write(
@ -131,7 +131,7 @@ Client.prototype.connect = function(args) {
if (config.bind) {
server.localAddress = config.bind;
if(args.tls) {
if (args.tls) {
var socket = net.connect(server);
server.socket = socket;
}
@ -152,7 +152,7 @@ Client.prototype.connect = function(args) {
});
var nick = args.nick || "shout-user";
var username = args.username || nick.replace(/[^a-zA-Z0-9]/g, '');
var username = args.username || nick.replace(/[^a-zA-Z0-9]/g, "");
var realname = args.realname || "Shout User";
var irc = slate(stream);
@ -273,10 +273,10 @@ Client.prototype.sort = function(data) {
var type = data.type;
var order = data.order || [];
var sorted = [];
switch (type) {
case "networks":
var sorted = [];
_.each(order, function(i) {
var find = _.find(self.networks, {id: i});
if (find) {
@ -292,7 +292,6 @@ Client.prototype.sort = function(data) {
if (!network) {
return;
}
var sorted = [];
_.each(order, function(i) {
var find = _.find(network.channels, {id: i});
if (find) {
@ -328,7 +327,7 @@ Client.prototype.save = function(force) {
var client = this;
var config = Helper.getConfig();
if(config.public) {
if (config.public) {
return;
}
@ -360,7 +359,7 @@ Client.prototype.save = function(force) {
try {
json = JSON.parse(data);
json.networks = networks;
} catch(e) {
} catch (e) {
console.log(e);
return;
}

View file

@ -3,7 +3,6 @@ var fs = require("fs");
var Client = require("./client");
var mkdirp = require("mkdirp");
var Helper = require("./helper");
var moment = require("moment");
module.exports = ClientManager;
@ -14,7 +13,7 @@ function ClientManager() {
ClientManager.prototype.findClient = function(name) {
for (var i in this.clients) {
var client = this.clients[i];
if (client.name == name) {
if (client.name === name) {
return client;
}
}
@ -35,7 +34,7 @@ ClientManager.prototype.loadUser = function(name) {
"utf-8"
);
json = JSON.parse(json);
} catch(e) {
} catch (e) {
console.log(e);
return;
}
@ -62,7 +61,7 @@ ClientManager.prototype.getUsers = function() {
users.push(file.replace(".json", ""));
}
});
} catch(e) {
} catch (e) {
console.log(e);
return;
}
@ -88,7 +87,7 @@ ClientManager.prototype.addUser = function(name, password) {
JSON.stringify(user, null, " "),
{mode: "0777"}
);
} catch(e) {
} catch (e) {
throw e;
}
return true;
@ -102,15 +101,14 @@ ClientManager.prototype.removeUser = function(name) {
try {
var path = Helper.HOME + "/users/" + name + ".json";
fs.unlinkSync(path);
} catch(e) {
} catch (e) {
throw e;
}
return true;
};
ClientManager.prototype.autoload = function(sockets) {
ClientManager.prototype.autoload = function(/* sockets */) {
var self = this;
var loaded = [];
setInterval(function() {
var loaded = _.pluck(
self.clients,

View file

@ -8,7 +8,7 @@ var Helper = require("../helper");
program
.command("add <name>")
.description("Add a new user")
.action(function(name, password) {
.action(function(name/* , password */) {
var path = Helper.HOME + "/users";
try {
mkdirp.sync(path);

View file

@ -1,7 +1,4 @@
var fs = require("fs");
var path = require("path");
var program = require("commander");
var mkdirp = require("mkdirp");
var child = require("child_process");
var Helper = require("../helper");

View file

@ -1,4 +1,3 @@
var _ = require("lodash");
var ClientManager = new require("../clientManager");
var program = require("commander");
var shout = require("../server");

View file

@ -7,4 +7,4 @@ module.exports = {
function getConfig() {
return require(path.resolve(this.HOME) + "/config");
};
}

View file

@ -4,7 +4,7 @@ var net = require("net");
var users = {};
module.exports.start = function(port) {
var server = net.createServer(init).listen(port || 113);
net.createServer(init).listen(port || 113);
};
module.exports.hook = function(stream, user) {

View file

@ -7,7 +7,7 @@ module.exports.write = function(user, network, chan, msg) {
try {
var path = Helper.HOME + "/logs/" + user + "/" + network;
mkdirp.sync(path);
} catch(e) {
} catch (e) {
console.log(e);
return;
}
@ -20,7 +20,7 @@ module.exports.write = function(user, network, chan, msg) {
var line = "[" + time + "] ";
var type = msg.type.trim();
if (type == "message" || type == "highlight") {
if (type === "message" || type === "highlight") {
// Format:
// [2014-01-01 00:00:00] <Arnold> Put that cookie down.. Now!!
line += "<" + msg.from + "> " + msg.text;
@ -38,7 +38,7 @@ module.exports.write = function(user, network, chan, msg) {
line + "\n",
function(e) {
if (e) {
console.log("Log#write():\n" + e)
console.log("Log#write():\n" + e);
}
}
);

View file

@ -37,7 +37,7 @@ Chan.prototype.sortUsers = function() {
modes.forEach(function(mode) {
this.users = _.remove(
this.users,
function(u) { return u.mode == mode; }
function(u) { return u.mode === mode; }
).concat(this.users);
}, this);
};

View file

@ -1,13 +1,13 @@
var Msg = require("../../models/msg");
module.exports = function(network, chan, cmd, args) {
if (cmd != "slap" && cmd != "me") {
if (cmd !== "slap" && cmd !== "me") {
return;
}
var client = this;
var irc = network.irc;
switch (cmd) {
case "slap":
var slap = "slaps " + args[0] + " around a bit with a large trout";
@ -16,13 +16,13 @@ module.exports = function(network, chan, cmd, args) {
if (args.length === 0) {
break;
}
var text = slap || args.join(" ");
irc.action(
chan.name,
text
);
var msg = new Msg({
type: Msg.Type.ACTION,
from: irc.me,

View file

@ -1,5 +1,5 @@
module.exports = function(network, chan, cmd, args) {
if (cmd != "connect" && cmd != "server") {
if (cmd !== "connect" && cmd !== "server") {
return;
}
if (args.length !== 0) {

View file

@ -1,5 +1,5 @@
module.exports = function(network, chan, cmd, args) {
if (cmd != "invite") {
if (cmd !== "invite") {
return;
}
var irc = network.irc;

View file

@ -1,5 +1,5 @@
module.exports = function(network, chan, cmd, args) {
if (cmd != "join") {
if (cmd !== "join") {
return;
}
if (args.length !== 0) {

View file

@ -1,5 +1,5 @@
module.exports = function(network, chan, cmd, args) {
if (cmd != "kick") {
if (cmd !== "kick") {
return;
}
if (args.length !== 0) {

View file

@ -1,19 +1,19 @@
module.exports = function(network, chan, cmd, args) {
if (cmd != "mode" && cmd != "op" && cmd != "voice" && cmd != "deop" && cmd != "devoice") {
if (cmd !== "mode" && cmd !== "op" && cmd !== "voice" && cmd !== "deop" && cmd !== "devoice") {
return;
} else if (args.length === 0) {
return;
}
var mode;
var user;
if (cmd != "mode") {
if (cmd !== "mode") {
user = args[0];
mode = {
"op": "+o",
"voice": "+v",
"deop": "-o",
"devoice": "-v"
"op": "+o",
"voice": "+v",
"deop": "-o",
"devoice": "-v"
}[cmd];
} else if (args.length === 1) {
return;

View file

@ -1,16 +1,15 @@
var _ = require("lodash");
module.exports = function(network, chan, cmd, args) {
if (cmd != "say" && cmd != "msg") {
if (cmd !== "say" && cmd !== "msg") {
return;
}
if (args.length === 0 || args[0] === "") {
return;
}
var client = this;
var irc = network.irc;
var target = "";
if (cmd == "msg") {
if (cmd === "msg") {
target = args.shift();
if (args.length === 0) {
return;

View file

@ -1,5 +1,5 @@
module.exports = function(network, chan, cmd, args) {
if (cmd != "nick") {
if (cmd !== "nick") {
return;
}
if (args.length !== 0) {

View file

@ -1,5 +1,5 @@
module.exports = function(network, chan, cmd, args) {
if (cmd != "notice" || !args[1]) {
if (cmd !== "notice" || !args[1]) {
return;
}
var irc = network.irc;

View file

@ -1,11 +1,11 @@
var _ = require("lodash");
module.exports = function(network, chan, cmd, args) {
if (cmd != "part" && cmd != "leave" && cmd != "close") {
if (cmd !== "part" && cmd !== "leave" && cmd !== "close") {
return;
}
var client = this;
if (chan.type == "query") {
if (chan.type === "query") {
network.channels = _.without(network.channels, chan);
client.emit("part", {
chan: chan.id

View file

@ -1,19 +1,19 @@
var _ = require("lodash");
module.exports = function(network, chan, cmd, args) {
if (cmd != "quit" && cmd != "disconnect") {
if (cmd !== "quit" && cmd !== "disconnect") {
return;
}
var client = this;
var irc = network.irc;
var quitMessage = args[0] ? args.join(" ") : "";
client.networks = _.without(client.networks, network);
client.save();
client.emit("quit", {
network: network.id
});
irc.quit(quitMessage);
};

View file

@ -1,5 +1,5 @@
module.exports = function(network, chan, cmd, args) {
if (cmd != "raw" && cmd != "send" && cmd != "quote") {
if (cmd !== "raw" && cmd !== "send" && cmd !== "quote") {
return;
}
if (args.length !== 0) {

View file

@ -1,7 +1,7 @@
var _ = require("lodash");
module.exports = function(network, chan, cmd, args) {
if (cmd != "ns" && cmd != "cs" && cmd != "hs") {
if (cmd !== "ns" && cmd !== "cs" && cmd !== "hs") {
return;
}
var target = ({

View file

@ -1,12 +1,12 @@
module.exports = function(network, chan, cmd, args) {
if (cmd != "topic") {
if (cmd !== "topic") {
return;
}
var msg = "TOPIC";
msg += " " + chan.name;
msg += args[0] ? (" :" + args.join(" ")) : "";
var irc = network.irc;
irc.write(msg);
};

View file

@ -1,5 +1,5 @@
module.exports = function(network, chan, cmd, args) {
if (cmd != "whois" && cmd != "query") {
if (cmd !== "whois" && cmd !== "query") {
return;
}
if (args.length !== 0) {

View file

@ -1,6 +1,6 @@
var pkg = require(process.cwd() + "/package.json");
module.exports = function(irc, network) {
module.exports = function(irc/* , network */) {
irc.on("message", function(data) {
if (data.message.indexOf("\001") !== 0) {
return;
@ -15,7 +15,7 @@ module.exports = function(irc, network) {
);
break;
case "PING":
if (split.length == 2) {
if (split.length === 2) {
irc.ctcp(data.from, "PING " + split[1]);
}
break;

View file

@ -13,7 +13,7 @@ module.exports = function(irc, network) {
msg: msg
});
if (!network.connected) {
if (data.cmd == "ERR_NICKNAMEINUSE") {
if (data.cmd === "ERR_NICKNAMEINUSE") {
var random = irc.me + Math.floor(10 + (Math.random() * 89));
irc.nick(random);
}

View file

@ -26,7 +26,7 @@ module.exports = function(irc, network) {
users: users
});
var self = false;
if (data.nick.toLowerCase() == irc.me.toLowerCase()) {
if (data.nick.toLowerCase() === irc.me.toLowerCase()) {
self = true;
}
var msg = new Msg({

View file

@ -12,7 +12,7 @@ module.exports = function(irc, network) {
return;
}
if (data.client == irc.me) {
if (data.client === irc.me) {
chan.users = [];
} else {
chan.users = _.without(chan.users, _.findWhere(chan.users, {name: data.client}));
@ -24,7 +24,7 @@ module.exports = function(irc, network) {
});
var self = false;
if (data.nick.toLowerCase() == irc.me.toLowerCase()) {
if (data.nick.toLowerCase() === irc.me.toLowerCase()) {
self = true;
}

View file

@ -3,7 +3,7 @@ var cheerio = require("cheerio");
var Msg = require("../../models/msg");
var request = require("request");
var Helper = require("../../helper");
var es = require('event-stream');
var es = require("event-stream");
process.setMaxListeners(0);
@ -28,7 +28,7 @@ module.exports = function(irc, network) {
return;
}
var self = data.to.toLowerCase() == irc.me.toLowerCase();
var self = data.to.toLowerCase() === irc.me.toLowerCase();
var chan = _.findWhere(network.channels, {name: self ? data.from : data.to});
if (typeof chan === "undefined") {
return;
@ -67,12 +67,12 @@ function parse(msg, url, res, client) {
toggle.type = "link";
toggle.head = $("title").text();
toggle.body =
$('meta[name=description]').attr('content')
|| $('meta[property="og:description"]').attr('content')
$("meta[name=description]").attr("content")
|| $("meta[property=\"og:description\"]").attr("content")
|| "No description found.";
toggle.thumb =
$('meta[property="og:image"]').attr('content')
|| $('meta[name="twitter:image:src"]').attr('content')
$("meta[property=\"og:image\"]").attr("content")
|| $("meta[name=\"twitter:image:src\"]").attr("content")
|| "";
break;
@ -93,18 +93,18 @@ function parse(msg, url, res, client) {
function fetch(url, cb) {
try {
var req = request.get(url);
} catch(e) {
} catch (e) {
return;
}
var length = 0;
var limit = 1024 * 10;
req
.on('response', function(res) {
if (!(/(text\/html|application\/json)/.test(res.headers['content-type']))) {
res.req.abort();
.on("response", function(res) {
if (!(/(text\/html|application\/json)/.test(res.headers["content-type"]))) {
res.req.abort();
}
})
.on('error', function() {})
.on("error", function() {})
.pipe(es.map(function(data, next) {
length += data.length;
if (length > limit) {
@ -118,12 +118,12 @@ function fetch(url, cb) {
var type;
try {
body = JSON.parse(data);
} catch(e) {
} catch (e) {
body = {};
}
try {
type = req.response.headers['content-type'].split(/ *; */).shift();
} catch(e) {
type = req.response.headers["content-type"].split(/ *; */).shift();
} catch (e) {
type = {};
}
data = {

View file

@ -5,13 +5,13 @@ var Msg = require("../../models/msg");
module.exports = function(irc, network) {
var client = this;
irc.on("message", function(data) {
if (data.message.indexOf("\u0001") === 0 && data.message.substring(0, 7) != "\u0001ACTION") {
if (data.message.indexOf("\u0001") === 0 && data.message.substring(0, 7) !== "\u0001ACTION") {
// Hide ctcp messages.
return;
}
var target = data.to;
if (target.toLowerCase() == irc.me.toLowerCase()) {
if (target.toLowerCase() === irc.me.toLowerCase()) {
target = data.from;
}
@ -40,11 +40,11 @@ module.exports = function(irc, network) {
});
var self = false;
if (data.from.toLowerCase() == irc.me.toLowerCase()) {
if (data.from.toLowerCase() === irc.me.toLowerCase()) {
self = true;
}
if (chan.id != client.activeChannel) {
if (chan.id !== client.activeChannel) {
chan.unread++;
}

View file

@ -14,7 +14,7 @@ module.exports = function(irc, network) {
from = data.target;
}
var self = false;
if (from.toLowerCase() == irc.me.toLowerCase()) {
if (from.toLowerCase() === irc.me.toLowerCase()) {
self = true;
}
var msg = new Msg({

View file

@ -6,7 +6,7 @@ module.exports = function(irc, network) {
irc.on("nick", function(data) {
var self = false;
var nick = data["new"];
if (nick == irc.me) {
if (nick === irc.me) {
var lobby = network.channels[0];
var msg = new Msg({
text: "You're now known as " + nick,

View file

@ -5,7 +5,7 @@ module.exports = function(irc, network) {
var client = this;
irc.on("notice", function(data) {
var target = data.to;
if (target.toLowerCase() == irc.me.toLowerCase()) {
if (target.toLowerCase() === irc.me.toLowerCase()) {
target = data.from;
}
@ -15,7 +15,7 @@ module.exports = function(irc, network) {
}
var from = data.from || "";
if (data.to == "*" || data.from.indexOf(".") !== -1) {
if (data.to === "*" || data.from.indexOf(".") !== -1) {
from = "";
}
var msg = new Msg({

View file

@ -9,7 +9,7 @@ module.exports = function(irc, network) {
return;
}
var from = data.nick;
if (from == irc.me) {
if (from === irc.me) {
network.channels = _.without(network.channels, chan);
client.save();
client.emit("part", {

View file

@ -26,7 +26,6 @@ module.exports = function(irc, network) {
channels: "on",
server: "using"
};
var i = 0;
for (var k in data) {
var key = prefix[k];
if (!key || data[k].toString() === "") {

View file

@ -26,7 +26,7 @@ module.exports = function(options) {
var protocol = https.enable ? "https" : "http";
var port = config.port;
var host = config.host;
var transports = config.transports || ['websocket', 'polling'];
var transports = config.transports || ["websocket", "polling"];
if (!https.enable){
server = require("http");
@ -36,7 +36,7 @@ module.exports = function(options) {
server = server.createServer({
key: fs.readFileSync(https.key),
cert: fs.readFileSync(https.certificate)
}, app).listen(port, host)
}, app).listen(port, host);
}
if ((config.identd || {}).enable) {
@ -71,7 +71,7 @@ module.exports = function(options) {
};
function index(req, res, next) {
if (req.url.split("?")[0] != "/") return next();
if (req.url.split("?")[0] !== "/") return next();
return fs.readFile("client/index.html", "utf-8", function(err, file) {
var data = _.merge(
require("../package.json"),
@ -144,10 +144,10 @@ function auth(data) {
var success = false;
_.each(manager.clients, function(client) {
if (data.token) {
if (data.token == client.token) {
if (data.token === client.token) {
success = true;
}
} else if (client.config.user == data.user) {
} else if (client.config.user === data.user) {
if (bcrypt.compareSync(data.password || "", client.config.password)) {
success = true;
}

View file

@ -1,37 +1,37 @@
var assert = require('assert');
var assert = require("assert");
var util = require('../util');
var link = require('../../src/plugins/irc-events/link.js');
var util = require("../util");
var link = require("../../src/plugins/irc-events/link.js");
describe('Link plugin', function() {
before(function(done) {
this.app = util.createWebserver();
this.connection = this.app.listen(9002, done);
});
describe("Link plugin", function() {
before(function(done) {
this.app = util.createWebserver();
this.connection = this.app.listen(9002, done);
});
after(function(done) {
this.connection.close(done);
});
after(function(done) {
this.connection.close(done);
});
beforeEach(function() {
this.irc = util.createClient();
this.network = util.createNetwork();
});
beforeEach(function() {
this.irc = util.createClient();
this.network = util.createNetwork();
});
it('should be able to fetch basic information about URLs', function(done) {
var plugin = link.call(this.irc, this.irc, this.network);
it("should be able to fetch basic information about URLs", function(done) {
link.call(this.irc, this.irc, this.network);
this.app.get('/basic', function(req, res) {
res.send('<title>test</title>');
});
this.app.get("/basic", function(req, res) {
res.send("<title>test</title>");
});
this.irc.createMessage({
message: 'http://localhost:9002/basic'
});
this.irc.createMessage({
message: "http://localhost:9002/basic"
});
this.irc.once('toggle', function(data) {
assert.equal(data.head, 'test');
done();
})
});
this.irc.once("toggle", function(data) {
assert.equal(data.head, "test");
done();
});
});
});

View file

@ -1,43 +1,41 @@
var EventEmitter = require('events').EventEmitter;
var util = require('util');
var _ = require('lodash');
var express = require('express');
var EventEmitter = require("events").EventEmitter;
var util = require("util");
var _ = require("lodash");
var express = require("express");
function MockClient(opts) {
this.me = 'test-user';
this.me = "test-user";
for(k in opts) {
this[k] = opts[k];
}
for (var k in opts) {
this[k] = opts[k];
}
}
util.inherits(MockClient, EventEmitter);
MockClient.prototype.createMessage = function(opts) {
var message = _.extend({
message: 'dummy message',
from: 'test-user',
to: 'test-channel'
}, opts);
var message = _.extend({
message: "dummy message",
from: "test-user",
to: "test-channel"
}, opts);
this.emit('message', message);
}
this.emit("message", message);
};
module.exports = {
createClient: function() {
return new MockClient();
},
createNetwork: function() {
return {
channels: [{
name: 'test-channel',
messages: []
}]
}
},
createWebserver: function() {
return express();
}
}
createClient: function() {
return new MockClient();
},
createNetwork: function() {
return {
channels: [{
name: "test-channel",
messages: []
}]
};
},
createWebserver: function() {
return express();
}
};