mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-25 07:06:49 +00:00
jest setup changes, increase setMaxListeners, disable console.log in tests/unit/global_vars
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
const Application = require("spectron").Application;
|
||||
const assert = require("assert");
|
||||
const path = require("path");
|
||||
const EventEmitter = require("events");
|
||||
|
||||
exports.getElectronPath = function () {
|
||||
let electronPath = path.join(__dirname, "..", "..", "node_modules", ".bin", "electron");
|
||||
@@ -26,6 +27,9 @@ exports.setupTimeout = function (test) {
|
||||
};
|
||||
|
||||
exports.startApplication = function (options) {
|
||||
const emitter = new EventEmitter();
|
||||
emitter.setMaxListeners(100);
|
||||
|
||||
options.path = exports.getElectronPath();
|
||||
if (process.env.CI) {
|
||||
options.startTimeout = 30000;
|
||||
|
@@ -27,19 +27,21 @@ describe("Vendors", function () {
|
||||
describe("Get list vendors", function () {
|
||||
const vendors = require(__dirname + "/../../vendor/vendor.js");
|
||||
Object.keys(vendors).forEach((vendor) => {
|
||||
it(`should return 200 HTTP code for vendor "${vendor}"`, function () {
|
||||
it(`should return 200 HTTP code for vendor "${vendor}"`, function (done) {
|
||||
const urlVendor = "http://localhost:8080/vendor/" + vendors[vendor];
|
||||
fetch(urlVendor).then((res) => {
|
||||
expect(res.status).toBe(200);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Object.keys(vendors).forEach((vendor) => {
|
||||
it(`should return 404 HTTP code for vendor https://localhost/"${vendor}"`, function () {
|
||||
it(`should return 404 HTTP code for vendor https://localhost/"${vendor}"`, function (done) {
|
||||
const urlVendor = "http://localhost:8080/" + vendors[vendor];
|
||||
fetch(urlVendor).then((res) => {
|
||||
expect(res.status).toBe(404);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user