2020-04-19 08:18:11 +02:00
|
|
|
const fs = require("fs");
|
|
|
|
const path = require("path");
|
2017-01-24 12:22:43 +01:00
|
|
|
|
2021-09-09 20:50:35 +02:00
|
|
|
const root_path = path.join(__dirname, "../../..");
|
|
|
|
const version = require(`${__dirname}/../../../package.json`).version;
|
2017-01-25 22:42:04 +01:00
|
|
|
|
2022-10-04 10:15:24 +02: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) => {
|
2022-10-04 10:15:24 +02: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
|
|
|
|
2022-10-04 10:15:24 +02:00
|
|
|
it("should not modify global.root_path for testing", () => {
|
2021-06-08 00:47:15 +02:00
|
|
|
expect(global.root_path).toBe(undefined);
|
2017-01-25 22:42:04 +01:00
|
|
|
});
|
|
|
|
|
2022-10-04 10:15:24 +02:00
|
|
|
it("should not modify global.version for testing", () => {
|
2021-06-08 00:47:15 +02:00
|
|
|
expect(global.version).toBe(undefined);
|
2017-01-25 22:42:04 +01:00
|
|
|
});
|
2017-02-07 19:35:51 -03:00
|
|
|
|
2022-10-04 10:15:24 +02: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
|
|
|
});
|