2017-07-24 22:08:12 +02:00
|
|
|
const helpers = require("./global-setup");
|
2017-03-09 21:12:19 -03:00
|
|
|
const request = require("request");
|
2017-07-24 22:08:12 +02:00
|
|
|
const expect = require("chai").expect;
|
|
|
|
|
|
|
|
const describe = global.describe;
|
|
|
|
const it = global.it;
|
|
|
|
const beforeEach = global.beforeEach;
|
|
|
|
const afterEach = global.afterEach;
|
2017-03-09 21:12:19 -03:00
|
|
|
|
|
|
|
describe("port directive configuration", function () {
|
2017-07-24 22:08:12 +02:00
|
|
|
helpers.setupTimeout(this);
|
2017-03-09 21:12:19 -03:00
|
|
|
|
2017-07-24 22:08:12 +02:00
|
|
|
var app = null;
|
2017-03-09 21:12:19 -03:00
|
|
|
|
2017-07-24 22:08:12 +02:00
|
|
|
beforeEach(function () {
|
|
|
|
return helpers.startApplication({
|
|
|
|
args: ["js/electron.js"]
|
2019-06-05 10:23:58 +02:00
|
|
|
}).then(function (startedApp) { app = startedApp; });
|
2017-03-09 21:12:19 -03:00
|
|
|
});
|
|
|
|
|
2017-07-24 22:08:12 +02:00
|
|
|
afterEach(function () {
|
|
|
|
return helpers.stopApplication(app);
|
2017-03-09 21:12:19 -03:00
|
|
|
});
|
|
|
|
|
|
|
|
describe("Set port 8090", function () {
|
2017-07-24 22:08:12 +02:00
|
|
|
before(function () {
|
2017-03-09 21:12:19 -03:00
|
|
|
// Set config sample for use in this test
|
|
|
|
process.env.MM_CONFIG_FILE = "tests/configs/port_8090.js";
|
|
|
|
});
|
2017-07-24 22:08:12 +02:00
|
|
|
|
2017-03-09 21:12:19 -03:00
|
|
|
it("should return 200", function (done) {
|
|
|
|
request.get("http://localhost:8090", function (err, res, body) {
|
|
|
|
expect(res.statusCode).to.equal(200);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2017-03-10 18:21:06 -03:00
|
|
|
|
2019-06-04 10:15:50 +02:00
|
|
|
describe("Set port 8100 on environment variable MM_PORT", function () {
|
2017-07-24 22:08:12 +02:00
|
|
|
before(function () {
|
2017-03-10 18:21:06 -03:00
|
|
|
process.env.MM_PORT = 8100;
|
|
|
|
// Set config sample for use in this test
|
|
|
|
process.env.MM_CONFIG_FILE = "tests/configs/port_8090.js";
|
|
|
|
});
|
2017-03-30 16:32:51 -03:00
|
|
|
|
2017-07-24 22:08:12 +02:00
|
|
|
after(function () {
|
2017-03-30 16:32:51 -03:00
|
|
|
delete process.env.MM_PORT;
|
|
|
|
});
|
2017-07-24 22:08:12 +02:00
|
|
|
|
2017-03-10 18:21:06 -03:00
|
|
|
it("should return 200", function (done) {
|
|
|
|
request.get("http://localhost:8100", function (err, res, body) {
|
|
|
|
expect(res.statusCode).to.equal(200);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2017-03-09 21:12:19 -03:00
|
|
|
});
|