MagicMirror/tests/e2e/serveronly_spec.js
Kristjan ESPERANTO d9f9f41e98
Add spell check (#3544)
I felt like adding a spell checker, but it's okay if you find it
superfluous. At least then we could fix the found spell issues.

What is still missing is an automatic integration so that the spell
checker does not have to be called manually. Would it perhaps make sense
to always do it before a release?
2024-09-18 07:37:09 +02:00

27 lines
858 B
JavaScript

const delay = (time) => {
return new Promise((resolve) => setTimeout(resolve, time));
};
describe("App environment", () => {
let serverProcess;
beforeAll(async () => {
process.env.MM_CONFIG_FILE = "tests/configs/default.js";
serverProcess = await require("node:child_process").spawn("npm", ["run", "server"], { env: process.env, detached: true });
// we have to wait until the server is started
await delay(2000);
});
afterAll(async () => {
await process.kill(-serverProcess.pid);
});
it("get request from http://localhost:8080 should return 200", async () => {
const res = await fetch("http://localhost:8080");
expect(res.status).toBe(200);
});
it("get request from http://localhost:8080/nothing should return 404", async () => {
const res = await fetch("http://localhost:8080/nothing");
expect(res.status).toBe(404);
});
});