mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-10-28 06:19:58 +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
```
26 lines
534 B
JavaScript
26 lines
534 B
JavaScript
var fs = require("fs");
|
|
var path = require("path");
|
|
var chai = require("chai");
|
|
var expect = chai.expect;
|
|
|
|
describe("'global.root_path' set in js/app.js", function() {
|
|
var appMM = require("../../../js/app.js")
|
|
|
|
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() {
|
|
expect(fs.existsSync(path.join(global.root_path, subpath))).to.equal(true);
|
|
});
|
|
});
|
|
});
|
|
|