Files
MagicMirror/tests/e2e/ipWhitelist_spec.js
T

32 lines
821 B
JavaScript
Raw Normal View History

2023-01-01 18:09:08 +01:00
const helpers = require("./helpers/global-setup");
2017-07-24 22:08:12 +02:00
2023-01-01 18:09:08 +01:00
describe("ipWhitelist directive configuration", () => {
describe("Set ipWhitelist without access", () => {
beforeAll(async () => {
await helpers.startApplication("tests/configs/noIpWhiteList.js");
2021-09-16 22:36:18 +02:00
});
2023-01-01 18:09:08 +01:00
afterAll(async () => {
await helpers.stopApplication();
2017-03-07 21:22:27 -03:00
});
2021-04-08 21:12:56 +02:00
2023-01-01 18:09:08 +01:00
it("should return 403", async () => {
2023-10-01 20:13:41 +02:00
const res = await fetch("http://localhost:8181");
2023-01-01 18:09:08 +01:00
expect(res.status).toBe(403);
2017-03-07 16:21:15 -03:00
});
});
2017-03-07 21:22:27 -03:00
2023-01-01 18:09:08 +01:00
describe("Set ipWhitelist []", () => {
beforeAll(async () => {
await helpers.startApplication("tests/configs/empty_ipWhiteList.js");
2021-09-16 22:36:18 +02:00
});
2023-01-01 18:09:08 +01:00
afterAll(async () => {
await helpers.stopApplication();
2017-03-07 21:22:27 -03:00
});
2021-04-08 21:12:56 +02:00
2023-01-01 18:09:08 +01:00
it("should return 200", async () => {
2023-10-01 20:13:41 +02:00
const res = await fetch("http://localhost:8282");
2023-01-01 18:09:08 +01:00
expect(res.status).toBe(200);
2017-03-07 21:22:27 -03:00
});
});
2017-03-07 16:21:15 -03:00
});