mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-10-26 13:38:25 +00:00
- separated tests into e2e and unit directories
- created configs directory structure to support test framework
- added/modified `npm run test`, `npm run test:unit` and `npm run test:e2e` to target all, unit and e2e tests respectively
- modified some of the test names to be more descriptive
New structure of the Test Suite has following directory tree:
```
tests
├── configs
│ ├── env.js
│ └── modules
│ ├── clock
│ │ ├── clock_12hr.js
│ │ ├── clock_24hr.js
│ │ └── clock_showPeriodUpper.js
│ └── helloworld
│ └── helloworld.js
├── e2e
│ ├── env_spec.js
│ └── modules
│ ├── clock_spec.js
│ └── helloworld_spec.js
└── unit
├── functions
│ └── cmp_versions_spec.js
└── global_vars
└── root_path_spec.js
```
21 lines
657 B
JavaScript
21 lines
657 B
JavaScript
var chai = require("chai");
|
|
var expect = chai.expect;
|
|
var classMM = require("../../../js/class.js"); // require for load module.js
|
|
var moduleMM = require("../../../js/module.js")
|
|
|
|
describe("Test function cmpVersions in js/module.js", function() {
|
|
|
|
it("should return -1 when comparing 2.1 to 2.2", function() {
|
|
expect(moduleMM._test.cmpVersions("2.1", "2.2")).to.equal(-1);
|
|
});
|
|
|
|
it("should be return 0 when comparing 2.2 to 2.2", function() {
|
|
expect(moduleMM._test.cmpVersions("2.2", "2.2")).to.equal(0);
|
|
});
|
|
|
|
it("should be return 1 when comparing 1.1 to 1.0", function() {
|
|
expect(moduleMM._test.cmpVersions("1.1", "1.0")).to.equal(1);
|
|
});
|
|
});
|
|
|