refactor e2e

This commit is contained in:
Karsten Hassel
2021-09-16 22:36:18 +02:00
parent c15b31b374
commit 9969fede35
9 changed files with 65 additions and 59 deletions

View File

@@ -1,18 +1,16 @@
const fetch = require("node-fetch");
const app = require("app.js");
const helpers = require("./global-setup");
let app = null;
describe("port directive configuration", function () {
beforeAll(function () {
process.env.MM_CONFIG_FILE = "tests/configs/port_8090.js";
app.start();
});
afterAll(function () {
app.stop();
});
describe("Set port 8090", function () {
beforeAll(function () {
app = helpers.startApplication("tests/configs/port_8090.js");
});
afterAll(function () {
helpers.stopApplication(app);
});
it("should return 200", function (done) {
fetch("http://localhost:8090").then((res) => {
expect(res.status).toBe(200);
@@ -23,11 +21,10 @@ describe("port directive configuration", function () {
describe("Set port 8100 on environment variable MM_PORT", function () {
beforeAll(function () {
process.env.MM_PORT = 8100;
app = helpers.startApplication("tests/configs/port_8090.js", (process.env.MM_PORT = 8100));
});
afterAll(function () {
delete process.env.MM_PORT;
helpers.stopApplication(app);
});
it("should return 200", function (done) {