mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 03:39:55 +00:00
41 lines
937 B
JavaScript
41 lines
937 B
JavaScript
const fetch = require("node-fetch");
|
|
const app = require("../../js/app.js");
|
|
|
|
describe("ipWhitelist directive configuration", function () {
|
|
beforeAll(function () {
|
|
app.start();
|
|
});
|
|
|
|
afterAll(function () {
|
|
app.stop();
|
|
});
|
|
|
|
describe("Set ipWhitelist without access", function () {
|
|
beforeAll(function () {
|
|
// Set config sample for use in test
|
|
process.env.MM_CONFIG_FILE = "tests/configs/noIpWhiteList.js";
|
|
});
|
|
|
|
it("should return 403", function (done) {
|
|
fetch("http://localhost:8080").then((res) => {
|
|
expect(res.status).toBe(403);
|
|
done();
|
|
});
|
|
});
|
|
});
|
|
|
|
describe("Set ipWhitelist []", function () {
|
|
beforeAll(function () {
|
|
// Set config sample for use in test
|
|
process.env.MM_CONFIG_FILE = "tests/configs/empty_ipWhiteList.js";
|
|
});
|
|
|
|
it("should return 200", function (done) {
|
|
fetch("http://localhost:8080").then((res) => {
|
|
expect(res.status).toBe(200);
|
|
done();
|
|
});
|
|
});
|
|
});
|
|
});
|