Merge pull request #1617 from thelounge/greenkeeper/mocha-4.0.1

Update mocha to the latest version 🚀
This commit is contained in:
Jérémie Astori 2017-10-17 02:10:58 -04:00 committed by GitHub
commit d1d871f351
5 changed files with 19 additions and 11 deletions

View File

@ -76,7 +76,7 @@
"jquery": "3.2.1", "jquery": "3.2.1",
"jquery-textcomplete": "1.8.4", "jquery-textcomplete": "1.8.4",
"jquery-ui": "1.12.1", "jquery-ui": "1.12.1",
"mocha": "3.5.3", "mocha": "4.0.1",
"mousetrap": "1.6.1", "mousetrap": "1.6.1",
"npm-run-all": "4.1.1", "npm-run-all": "4.1.1",
"nyc": "11.2.1", "nyc": "11.2.1",

View File

@ -91,6 +91,7 @@ function advancedLdapAuth(user, password, callback) {
callback(false); callback(false);
}); });
res.on("end", function() { res.on("end", function() {
ldapclient.unbind();
if (!found) { if (!found) {
callback(false); callback(false);
} }

View File

@ -177,6 +177,8 @@ module.exports = function() {
process.on("SIGINT", exitGracefully); process.on("SIGINT", exitGracefully);
process.on("SIGTERM", exitGracefully); process.on("SIGTERM", exitGracefully);
}); });
return server;
}; };
function getClientIp(request) { function getClientIp(request) {

View File

@ -109,29 +109,28 @@ function testLdapAuth() {
} }
describe("LDAP authentication plugin", function() { describe("LDAP authentication plugin", function() {
before(function(done) { before((done) => {
this.server = startLdapServer(done); this.server = startLdapServer(done);
}); });
after(function(done) {
after(() => {
this.server.close(); this.server.close();
done();
}); });
beforeEach(function(done) { beforeEach(() => {
Helper.config.public = false; Helper.config.public = false;
Helper.config.ldap.enable = true; Helper.config.ldap.enable = true;
Helper.config.ldap.url = "ldap://localhost:" + String(serverPort); Helper.config.ldap.url = "ldap://localhost:" + String(serverPort);
Helper.config.ldap.primaryKey = primaryKey; Helper.config.ldap.primaryKey = primaryKey;
done();
}); });
describe("LDAP authentication availability", function() { describe("LDAP authentication availability", function() {
it("checks that the configuration is correctly tied to isEnabled()", function(done) { it("checks that the configuration is correctly tied to isEnabled()", function() {
Helper.config.ldap.enable = true; Helper.config.ldap.enable = true;
expect(ldapAuth.isEnabled()).to.equal(true); expect(ldapAuth.isEnabled()).to.equal(true);
Helper.config.ldap.enable = false; Helper.config.ldap.enable = false;
expect(ldapAuth.isEnabled()).to.equal(false); expect(ldapAuth.isEnabled()).to.equal(false);
done();
}); });
}); });
@ -145,4 +144,3 @@ describe("LDAP authentication plugin", function() {
testLdapAuth(); testLdapAuth();
}); });
}); });

View File

@ -6,8 +6,15 @@ const request = require("request");
const io = require("socket.io-client"); const io = require("socket.io-client");
describe("Server", () => { describe("Server", () => {
const server = require("../src/server"); let server;
server();
before(() => {
server = require("../src/server")();
});
after((done) => {
server.close(done);
});
const webURL = `http://${Helper.config.host}:${Helper.config.port}/`; const webURL = `http://${Helper.config.host}:${Helper.config.port}/`;