snapshot e2e

This commit is contained in:
Karsten Hassel
2021-06-09 00:19:43 +02:00
parent 67011c0c32
commit 0e14d3d6e8
19 changed files with 93 additions and 116 deletions

View File

@@ -1,4 +1,3 @@
const expect = require("chai").expect;
const path = require("path");
const { JSDOM } = require("jsdom");
@@ -23,43 +22,43 @@ describe("File js/class", function () {
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);
expect(obj).toEqual(expected);
expect(expected === obj).toBe(false);
});
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);
expect(obj).toEqual(expected);
expect(expected === obj).toBe(false);
});
it("should clone number", function () {
let expected = 1;
let obj = clone(expected);
expect(obj).to.equal(expected);
expect(obj).toBe(expected);
expected = 1.23;
obj = clone(expected);
expect(obj).to.equal(expected);
expect(obj).toBe(expected);
});
it("should clone string", function () {
const expected = "Perfect stranger";
const obj = clone(expected);
expect(obj).to.equal(expected);
expect(obj).toBe(expected);
});
it("should clone undefined", function () {
const expected = undefined;
const obj = clone(expected);
expect(obj).to.equal(expected);
expect(obj).toBe(expected);
});
it("should clone null", function () {
const expected = null;
const obj = clone(expected);
expect(obj).to.equal(expected);
expect(obj).toBe(expected);
});
it("should clone nested object", function () {
@@ -75,13 +74,13 @@ describe("File js/class", function () {
}
};
const obj = clone(expected);
expect(obj).to.deep.equal(expected);
expect(expected === obj).to.equal(false);
expect(expected.versions === obj.versions).to.equal(false);
expect(expected.properties === obj.properties).to.equal(false);
expect(expected.properties.items === obj.properties.items).to.equal(false);
expect(expected.properties.items[0] === obj.properties.items[0]).to.equal(false);
expect(expected.properties.items[1] === obj.properties.items[1]).to.equal(false);
expect(obj).toEqual(expected);
expect(expected === obj).toBe(false);
expect(expected.versions === obj.versions).toBe(false);
expect(expected.properties === obj.properties).toBe(false);
expect(expected.properties.items === obj.properties.items).toBe(false);
expect(expected.properties.items[0] === obj.properties.items[0]).toBe(false);
expect(expected.properties.items[1] === obj.properties.items[1]).toBe(false);
});
describe("Test lockstring code", function () {
@@ -90,7 +89,7 @@ describe("File js/class", function () {
beforeAll(function () {
log = dom.window.Log.log;
dom.window.Log.log = function cmp(str) {
expect(str).to.equal("lockStrings");
expect(str).toBe("lockStrings");
};
});
@@ -101,8 +100,8 @@ describe("File js/class", function () {
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);
expect(obj).toEqual(expected);
expect(expected === obj).toBe(false);
});
});
});