2024-04-01 22:03:20 +02:00
|
|
|
const fs = require("node:fs");
|
|
|
|
|
const path = require("node:path");
|
2017-01-24 12:22:43 +01:00
|
|
|
|
2021-09-09 20:50:35 +02:00
|
|
|
const root_path = path.join(__dirname, "../../..");
|
2025-09-30 18:02:22 +02:00
|
|
|
const version = require(`${root_path}/package.json`).version;
|
2017-01-25 22:42:04 +01:00
|
|
|
|
2023-01-01 18:09:08 +01:00
|
|
|
describe("'global.root_path' set in js/app.js", () => {
|
2021-04-08 21:12:56 +02:00
|
|
|
const expectedSubPaths = ["modules", "serveronly", "js", "js/app.js", "js/main.js", "js/electron.js", "config"];
|
2017-01-24 12:22:43 +01:00
|
|
|
|
2020-05-11 22:22:32 +02:00
|
|
|
expectedSubPaths.forEach((subpath) => {
|
2023-01-01 18:09:08 +01:00
|
|
|
it(`contains a file/folder "${subpath}"`, () => {
|
2021-09-09 20:50:35 +02:00
|
|
|
expect(fs.existsSync(path.join(root_path, subpath))).toBe(true);
|
2017-01-24 12:22:43 +01:00
|
|
|
});
|
|
|
|
|
});
|
2017-01-25 22:42:04 +01:00
|
|
|
|
2023-01-01 18:09:08 +01:00
|
|
|
it("should not modify global.root_path for testing", () => {
|
2024-01-01 15:38:08 +01:00
|
|
|
expect(global.root_path).toBeUndefined();
|
2017-01-25 22:42:04 +01:00
|
|
|
});
|
|
|
|
|
|
2023-01-01 18:09:08 +01:00
|
|
|
it("should not modify global.version for testing", () => {
|
2024-01-01 15:38:08 +01:00
|
|
|
expect(global.version).toBeUndefined();
|
2017-01-25 22:42:04 +01:00
|
|
|
});
|
2017-02-07 19:35:51 -03:00
|
|
|
|
2023-01-01 18:09:08 +01:00
|
|
|
it("should expect the global.version equals package.json file", () => {
|
2020-05-05 14:54:49 +02:00
|
|
|
const versionPackage = JSON.parse(fs.readFileSync("package.json", "utf8")).version;
|
2021-09-09 20:50:35 +02:00
|
|
|
expect(version).toBe(versionPackage);
|
2017-02-07 19:35:51 -03:00
|
|
|
});
|
2017-01-24 12:22:43 +01:00
|
|
|
});
|