mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
SuiteTest: Added unit tests for js/class.js
This commit is contained in:
parent
bf24ee369f
commit
5ac20cc4cf
@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
- Add `clientonly` script to start only the electron client for a remote server.
|
||||
- Add symbol and color properties of event when `CALENDAR_EVENTS` notification is broadcasted from `default/calendar` module.
|
||||
- Add `.vscode/` folder to `.gitignore` to keep custom Visual Studio Code config out of git
|
||||
- Add unit test for js/class.js.
|
||||
|
||||
### Updated
|
||||
- Changed 'default.js' - listen on all attached interfaces by default
|
||||
|
@ -90,4 +90,9 @@ function cloneObject(obj) {
|
||||
}
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") { module.exports = Class; }
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = Class;
|
||||
module.exports._test = {
|
||||
cloneObject: cloneObject
|
||||
}
|
||||
}
|
||||
|
51
tests/unit/functions/class_spec.js
Normal file
51
tests/unit/functions/class_spec.js
Normal file
@ -0,0 +1,51 @@
|
||||
var chai = require("chai");
|
||||
var expect = chai.expect;
|
||||
var jsClass = require("../../../js/class.js");
|
||||
|
||||
describe("File js/class", function() {
|
||||
describe("Test function cloneObject", function() {
|
||||
var cloneObject = jsClass._test.cloneObject;
|
||||
|
||||
it("should be return equals object", function() {
|
||||
var expected = {name: "Rodrigo", web: "https://rodrigoramirez.com", project: "MagicMirror"};
|
||||
var obj = {};
|
||||
obj = cloneObject(expected);
|
||||
expect(expected).to.deep.equal(obj);
|
||||
});
|
||||
|
||||
it("should be return equals int", function() {
|
||||
var expected = 1;
|
||||
var obj = {};
|
||||
obj = cloneObject(expected);
|
||||
expect(expected).to.equal(obj);
|
||||
});
|
||||
|
||||
it("should be return equals string", function() {
|
||||
var expected = "Perfect stranger";
|
||||
var obj = {};
|
||||
obj = cloneObject(expected);
|
||||
expect(expected).to.equal(obj);
|
||||
});
|
||||
|
||||
it("should be return equals undefined", function() {
|
||||
var expected = undefined;
|
||||
var obj = {};
|
||||
obj = cloneObject(expected);
|
||||
expect(undefined).to.equal(obj);
|
||||
});
|
||||
|
||||
// CoverageME
|
||||
/*
|
||||
context("Test lockstring code", function() {
|
||||
it("should be return equals object", function() {
|
||||
var expected = {name: "Module", lockStrings: "stringLock"};
|
||||
var obj = {};
|
||||
obj = cloneObject(expected);
|
||||
expect(expected).to.deep.equal(obj);
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user