2022-10-07 19:16:37 +02:00
|
|
|
const helpers = require("./helpers/global-setup");
|
2017-07-24 22:08:12 +02:00
|
|
|
|
2022-09-20 23:43:06 +02:00
|
|
|
describe("App environment", () => {
|
2022-10-04 10:15:24 +02:00
|
|
|
beforeAll(async () => {
|
2022-10-29 22:34:17 +02:00
|
|
|
await helpers.startApplication("tests/configs/default.js");
|
2022-10-04 10:15:24 +02:00
|
|
|
await helpers.getDocument();
|
2017-01-30 12:29:32 -03:00
|
|
|
});
|
2022-09-20 23:43:06 +02:00
|
|
|
afterAll(async () => {
|
2022-05-27 19:46:28 +02:00
|
|
|
await helpers.stopApplication();
|
2017-01-30 12:29:32 -03:00
|
|
|
});
|
|
|
|
|
2022-10-04 10:15:24 +02:00
|
|
|
it("get request from http://localhost:8080 should return 200", async () => {
|
2023-09-09 21:12:31 +02:00
|
|
|
const res = await fetch("http://localhost:8080");
|
2022-10-04 10:15:24 +02:00
|
|
|
expect(res.status).toBe(200);
|
2017-03-08 10:36:08 -03:00
|
|
|
});
|
|
|
|
|
2022-10-04 10:15:24 +02:00
|
|
|
it("get request from http://localhost:8080/nothing should return 404", async () => {
|
2023-09-09 21:12:31 +02:00
|
|
|
const res = await fetch("http://localhost:8080/nothing");
|
2022-10-04 10:15:24 +02:00
|
|
|
expect(res.status).toBe(404);
|
2017-03-09 17:10:32 -03:00
|
|
|
});
|
2021-09-25 22:12:53 +02:00
|
|
|
|
2022-10-04 10:15:24 +02:00
|
|
|
it("should show the title MagicMirror²", async () => {
|
|
|
|
const elem = await helpers.waitForElement("title");
|
2023-11-20 20:11:41 +01:00
|
|
|
expect(elem).not.toBeNull();
|
2022-10-04 10:15:24 +02:00
|
|
|
expect(elem.textContent).toBe("MagicMirror²");
|
2021-09-25 22:12:53 +02:00
|
|
|
});
|
2017-01-30 12:29:32 -03:00
|
|
|
});
|