c2243ed7b4
I used `npm run coverage` while *not* excluding the test folder to detect dead code in our test folder, it is actually pretty useful to do so (as a one-shot, not to do that in our config). Only remaining unreached path is L40 in `test/plugins/auth/ldap.js`, but it does seem to me that it might be useful in case of failures, so I preferred to leave it there.
42 lines
832 B
JavaScript
42 lines
832 B
JavaScript
"use strict";
|
|
|
|
var EventEmitter = require("events").EventEmitter;
|
|
var util = require("util");
|
|
var _ = require("lodash");
|
|
var express = require("express");
|
|
var Network = require("../src/models/network");
|
|
var Chan = require("../src/models/chan");
|
|
|
|
function MockClient() {
|
|
this.user = {nick: "test-user"};
|
|
}
|
|
util.inherits(MockClient, EventEmitter);
|
|
|
|
MockClient.prototype.createMessage = function(opts) {
|
|
var message = _.extend({
|
|
text: "dummy message",
|
|
nick: "test-user",
|
|
target: "#test-channel",
|
|
previews: [],
|
|
}, opts);
|
|
|
|
return message;
|
|
};
|
|
|
|
module.exports = {
|
|
createClient: function() {
|
|
return new MockClient();
|
|
},
|
|
createNetwork: function() {
|
|
return new Network({
|
|
host: "example.com",
|
|
channels: [new Chan({
|
|
name: "#test-channel",
|
|
})],
|
|
});
|
|
},
|
|
createWebserver: function() {
|
|
return express();
|
|
},
|
|
};
|