mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 04:45:17 +00:00
Run prettier over ALL files once
No other changes done in this commit
This commit is contained in:
@@ -3,7 +3,7 @@ var path = require("path");
|
||||
var expect = require("chai").expect;
|
||||
var vm = require("vm");
|
||||
|
||||
before(function() {
|
||||
before(function () {
|
||||
var basedir = path.join(__dirname, "../../..");
|
||||
|
||||
var fileName = "js/app.js";
|
||||
@@ -15,15 +15,19 @@ before(function() {
|
||||
__dirname: path.dirname(filePath),
|
||||
global: {},
|
||||
console: {
|
||||
log: function() { /*console.log("console.log(", arguments, ")");*/ }
|
||||
log: function () {
|
||||
/*console.log("console.log(", arguments, ")");*/
|
||||
}
|
||||
},
|
||||
process: {
|
||||
on: function() { /*console.log("process.on called with: ", arguments);*/ },
|
||||
on: function () {
|
||||
/*console.log("process.on called with: ", arguments);*/
|
||||
},
|
||||
env: {}
|
||||
}
|
||||
};
|
||||
|
||||
this.sandbox.require = function(filename) {
|
||||
this.sandbox.require = function (filename) {
|
||||
// This modifies the global slightly,
|
||||
// but supplies vm with essential code
|
||||
return require(filename);
|
||||
@@ -32,36 +36,28 @@ before(function() {
|
||||
vm.runInNewContext(code, this.sandbox, fileName);
|
||||
});
|
||||
|
||||
after(function() {
|
||||
after(function () {
|
||||
//console.log(global);
|
||||
});
|
||||
|
||||
describe("'global.root_path' set in js/app.js", function() {
|
||||
var expectedSubPaths = [
|
||||
"modules",
|
||||
"serveronly",
|
||||
"js",
|
||||
"js/app.js",
|
||||
"js/main.js",
|
||||
"js/electron.js",
|
||||
"config"
|
||||
];
|
||||
describe("'global.root_path' set in js/app.js", function () {
|
||||
var expectedSubPaths = ["modules", "serveronly", "js", "js/app.js", "js/main.js", "js/electron.js", "config"];
|
||||
|
||||
expectedSubPaths.forEach(subpath => {
|
||||
it(`contains a file/folder "${subpath}"`, function() {
|
||||
expectedSubPaths.forEach((subpath) => {
|
||||
it(`contains a file/folder "${subpath}"`, function () {
|
||||
expect(fs.existsSync(path.join(this.sandbox.global.root_path, subpath))).to.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
it("should not modify global.root_path for testing", function() {
|
||||
it("should not modify global.root_path for testing", function () {
|
||||
expect(global.root_path).to.equal(undefined);
|
||||
});
|
||||
|
||||
it("should not modify global.version for testing", function() {
|
||||
it("should not modify global.version for testing", function () {
|
||||
expect(global.version).to.equal(undefined);
|
||||
});
|
||||
|
||||
it("should expect the global.version equals package.json file", function() {
|
||||
it("should expect the global.version equals package.json file", function () {
|
||||
const versionPackage = JSON.parse(fs.readFileSync("package.json", "utf8")).version;
|
||||
expect(this.sandbox.global.version).to.equal(versionPackage);
|
||||
});
|
||||
|
Reference in New Issue
Block a user