2022-10-07 19:16:37 +02:00
|
|
|
const helpers = require("./helpers/global-setup");
|
2017-07-24 22:08:12 +02:00
|
|
|
|
2022-10-04 10:15:24 +02:00
|
|
|
describe("ipWhitelist directive configuration", () => {
|
|
|
|
describe("Set ipWhitelist without access", () => {
|
2022-10-29 22:34:17 +02:00
|
|
|
beforeAll(async () => {
|
|
|
|
await helpers.startApplication("tests/configs/noIpWhiteList.js");
|
2021-09-16 22:36:18 +02:00
|
|
|
});
|
2022-10-04 10:15:24 +02:00
|
|
|
afterAll(async () => {
|
2022-05-27 19:46:28 +02:00
|
|
|
await helpers.stopApplication();
|
2017-03-07 21:22:27 -03:00
|
|
|
});
|
2021-04-08 21:12:56 +02:00
|
|
|
|
2022-10-04 10:15:24 +02:00
|
|
|
it("should return 403", async () => {
|
|
|
|
const res = await helpers.fetch("http://localhost:8080");
|
|
|
|
expect(res.status).toBe(403);
|
2017-03-07 16:21:15 -03:00
|
|
|
});
|
|
|
|
});
|
2017-03-07 21:22:27 -03:00
|
|
|
|
2022-10-04 10:15:24 +02:00
|
|
|
describe("Set ipWhitelist []", () => {
|
2022-10-29 22:34:17 +02:00
|
|
|
beforeAll(async () => {
|
|
|
|
await helpers.startApplication("tests/configs/empty_ipWhiteList.js");
|
2021-09-16 22:36:18 +02:00
|
|
|
});
|
2022-10-04 10:15:24 +02:00
|
|
|
afterAll(async () => {
|
2022-05-27 19:46:28 +02:00
|
|
|
await helpers.stopApplication();
|
2017-03-07 21:22:27 -03:00
|
|
|
});
|
2021-04-08 21:12:56 +02:00
|
|
|
|
2022-10-04 10:15:24 +02:00
|
|
|
it("should return 200", async () => {
|
|
|
|
const res = await helpers.fetch("http://localhost:8080");
|
|
|
|
expect(res.status).toBe(200);
|
2017-03-07 21:22:27 -03:00
|
|
|
});
|
|
|
|
});
|
2017-03-07 16:21:15 -03:00
|
|
|
});
|