mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
Run prettier over ALL files once
No other changes done in this commit
This commit is contained in:
@@ -1,38 +1,40 @@
|
||||
const expect = require("chai").expect;
|
||||
const path = require("path");
|
||||
const {JSDOM} = require("jsdom");
|
||||
const { JSDOM } = require("jsdom");
|
||||
|
||||
describe("File js/class", function() {
|
||||
describe("Test function cloneObject", function() {
|
||||
describe("File js/class", function () {
|
||||
describe("Test function cloneObject", function () {
|
||||
let clone;
|
||||
let dom;
|
||||
|
||||
before(function(done) {
|
||||
dom = new JSDOM(`<script>var Log = {log: function() {}};</script>\
|
||||
<script src="${path.join(__dirname, "..", "..", "..", "js", "class.js")}">`, { runScripts: "dangerously",
|
||||
resources: "usable" });
|
||||
dom.window.onload = function() {
|
||||
const {cloneObject} = dom.window;
|
||||
before(function (done) {
|
||||
dom = new JSDOM(
|
||||
`<script>var Log = {log: function() {}};</script>\
|
||||
<script src="${path.join(__dirname, "..", "..", "..", "js", "class.js")}">`,
|
||||
{ runScripts: "dangerously", resources: "usable" }
|
||||
);
|
||||
dom.window.onload = function () {
|
||||
const { cloneObject } = dom.window;
|
||||
clone = cloneObject;
|
||||
done();
|
||||
};
|
||||
});
|
||||
|
||||
it("should clone object", function() {
|
||||
const expected = {name: "Rodrigo", web: "https://rodrigoramirez.com", project: "MagicMirror"};
|
||||
it("should clone object", function () {
|
||||
const expected = { name: "Rodrigo", web: "https://rodrigoramirez.com", project: "MagicMirror" };
|
||||
const obj = clone(expected);
|
||||
expect(obj).to.deep.equal(expected);
|
||||
expect(expected === obj).to.equal(false);
|
||||
});
|
||||
|
||||
it("should clone array", function() {
|
||||
it("should clone array", function () {
|
||||
const expected = [1, null, undefined, "TEST"];
|
||||
const obj = clone(expected);
|
||||
expect(obj).to.deep.equal(expected);
|
||||
expect(expected === obj).to.equal(false);
|
||||
});
|
||||
|
||||
it("should clone number", function() {
|
||||
it("should clone number", function () {
|
||||
let expected = 1;
|
||||
let obj = clone(expected);
|
||||
expect(obj).to.equal(expected);
|
||||
@@ -42,32 +44,32 @@ describe("File js/class", function() {
|
||||
expect(obj).to.equal(expected);
|
||||
});
|
||||
|
||||
it("should clone string", function() {
|
||||
it("should clone string", function () {
|
||||
const expected = "Perfect stranger";
|
||||
const obj = clone(expected);
|
||||
expect(obj).to.equal(expected);
|
||||
});
|
||||
|
||||
it("should clone undefined", function() {
|
||||
it("should clone undefined", function () {
|
||||
const expected = undefined;
|
||||
const obj = clone(expected);
|
||||
expect(obj).to.equal(expected);
|
||||
});
|
||||
|
||||
it("should clone null", function() {
|
||||
it("should clone null", function () {
|
||||
const expected = null;
|
||||
const obj = clone(expected);
|
||||
expect(obj).to.equal(expected);
|
||||
});
|
||||
|
||||
it("should clone nested object", function() {
|
||||
it("should clone nested object", function () {
|
||||
const expected = {
|
||||
name: "fewieden",
|
||||
link: "https://github.com/fewieden",
|
||||
versions: ["2.0", "2.1", "2.2"],
|
||||
answerForAllQuestions: 42,
|
||||
properties: {
|
||||
items: [{foo: "bar"}, {lorem: "ipsum"}],
|
||||
items: [{ foo: "bar" }, { lorem: "ipsum" }],
|
||||
invalid: undefined,
|
||||
nothing: null
|
||||
}
|
||||
@@ -82,22 +84,22 @@ describe("File js/class", function() {
|
||||
expect(expected.properties.items[1] === obj.properties.items[1]).to.equal(false);
|
||||
});
|
||||
|
||||
describe("Test lockstring code", function() {
|
||||
describe("Test lockstring code", function () {
|
||||
let log;
|
||||
|
||||
before(function() {
|
||||
before(function () {
|
||||
log = dom.window.Log.log;
|
||||
dom.window.Log.log = function cmp(str) {
|
||||
expect(str).to.equal("lockStrings");
|
||||
};
|
||||
});
|
||||
|
||||
after(function() {
|
||||
after(function () {
|
||||
dom.window.Log.log = log;
|
||||
});
|
||||
|
||||
it("should clone object and log lockStrings", function() {
|
||||
const expected = {name: "Module", lockStrings: "stringLock"};
|
||||
it("should clone object and log lockStrings", function () {
|
||||
const expected = { name: "Module", lockStrings: "stringLock" };
|
||||
const obj = clone(expected);
|
||||
expect(obj).to.deep.equal(expected);
|
||||
expect(expected === obj).to.equal(false);
|
||||
@@ -105,4 +107,3 @@ describe("File js/class", function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user