mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
use internal fetch function of node instead external node-fetch
library if node version >= v18
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const fetch = require("node-fetch");
|
||||
const fetch = require("fetch");
|
||||
const helpers = require("./global-setup");
|
||||
|
||||
describe("App environment", function () {
|
||||
@@ -6,8 +6,8 @@ describe("App environment", function () {
|
||||
helpers.startApplication("tests/configs/default.js");
|
||||
helpers.getDocument(done);
|
||||
});
|
||||
afterAll(function () {
|
||||
helpers.stopApplication();
|
||||
afterAll(async function () {
|
||||
await helpers.stopApplication();
|
||||
});
|
||||
|
||||
it("get request from http://localhost:8080 should return 200", function (done) {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
const fetch = require("node-fetch");
|
||||
const fetch = require("fetch");
|
||||
const helpers = require("./global-setup");
|
||||
|
||||
describe("All font files from roboto.css should be downloadable", function () {
|
||||
@@ -17,8 +17,8 @@ describe("All font files from roboto.css should be downloadable", function () {
|
||||
beforeAll(function () {
|
||||
helpers.startApplication("tests/configs/without_modules.js");
|
||||
});
|
||||
afterAll(function () {
|
||||
helpers.stopApplication();
|
||||
afterAll(async function () {
|
||||
await helpers.stopApplication();
|
||||
});
|
||||
|
||||
test.each(fontFiles)("should return 200 HTTP code for file '%s'", (fontFile, done) => {
|
||||
|
@@ -16,10 +16,11 @@ exports.startApplication = function (configFilename, exec) {
|
||||
global.app.start();
|
||||
};
|
||||
|
||||
exports.stopApplication = function () {
|
||||
exports.stopApplication = async function () {
|
||||
if (global.app) {
|
||||
global.app.stop();
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
};
|
||||
|
||||
exports.getDocument = function (callback) {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
const fetch = require("node-fetch");
|
||||
const fetch = require("fetch");
|
||||
const helpers = require("./global-setup");
|
||||
|
||||
describe("ipWhitelist directive configuration", function () {
|
||||
@@ -6,8 +6,8 @@ describe("ipWhitelist directive configuration", function () {
|
||||
beforeAll(function () {
|
||||
helpers.startApplication("tests/configs/noIpWhiteList.js");
|
||||
});
|
||||
afterAll(function () {
|
||||
helpers.stopApplication();
|
||||
afterAll(async function () {
|
||||
await helpers.stopApplication();
|
||||
});
|
||||
|
||||
it("should return 403", function (done) {
|
||||
@@ -22,8 +22,8 @@ describe("ipWhitelist directive configuration", function () {
|
||||
beforeAll(function () {
|
||||
helpers.startApplication("tests/configs/empty_ipWhiteList.js");
|
||||
});
|
||||
afterAll(function () {
|
||||
helpers.stopApplication();
|
||||
afterAll(async function () {
|
||||
await helpers.stopApplication();
|
||||
});
|
||||
|
||||
it("should return 200", function (done) {
|
||||
|
@@ -5,8 +5,8 @@ describe("Alert module", function () {
|
||||
helpers.startApplication("tests/configs/modules/alert/default.js");
|
||||
helpers.getDocument(done);
|
||||
});
|
||||
afterAll(function () {
|
||||
helpers.stopApplication();
|
||||
afterAll(async function () {
|
||||
await helpers.stopApplication();
|
||||
});
|
||||
|
||||
it("should show the welcome message", function () {
|
||||
|
@@ -25,8 +25,8 @@ describe("Calendar module", function () {
|
||||
});
|
||||
};
|
||||
|
||||
afterAll(function () {
|
||||
helpers.stopApplication();
|
||||
afterAll(async function () {
|
||||
await helpers.stopApplication();
|
||||
});
|
||||
|
||||
describe("Default configuration", function () {
|
||||
|
@@ -1,8 +1,8 @@
|
||||
const helpers = require("../global-setup");
|
||||
|
||||
describe("Clock set to spanish language module", function () {
|
||||
afterAll(function () {
|
||||
helpers.stopApplication();
|
||||
afterAll(async function () {
|
||||
await helpers.stopApplication();
|
||||
});
|
||||
|
||||
const testMatch = function (element, regex) {
|
||||
|
@@ -2,8 +2,8 @@ const helpers = require("../global-setup");
|
||||
const moment = require("moment");
|
||||
|
||||
describe("Clock module", function () {
|
||||
afterAll(function () {
|
||||
helpers.stopApplication();
|
||||
afterAll(async function () {
|
||||
await helpers.stopApplication();
|
||||
});
|
||||
|
||||
const testMatch = function (element, regex) {
|
||||
|
@@ -16,8 +16,8 @@ function doTest(complimentsArray) {
|
||||
}
|
||||
|
||||
describe("Compliments module", function () {
|
||||
afterAll(function () {
|
||||
helpers.stopApplication();
|
||||
afterAll(async function () {
|
||||
await helpers.stopApplication();
|
||||
});
|
||||
|
||||
describe("parts of days", function () {
|
||||
|
@@ -1,8 +1,8 @@
|
||||
const helpers = require("../global-setup");
|
||||
|
||||
describe("Test helloworld module", function () {
|
||||
afterAll(function () {
|
||||
helpers.stopApplication();
|
||||
afterAll(async function () {
|
||||
await helpers.stopApplication();
|
||||
});
|
||||
|
||||
describe("helloworld set config text", function () {
|
||||
|
@@ -1,8 +1,8 @@
|
||||
const helpers = require("../global-setup");
|
||||
|
||||
describe("Newsfeed module", function () {
|
||||
afterAll(function () {
|
||||
helpers.stopApplication();
|
||||
afterAll(async function () {
|
||||
await helpers.stopApplication();
|
||||
});
|
||||
|
||||
describe("Default configuration", function () {
|
||||
|
@@ -40,8 +40,8 @@ describe("Weather module", function () {
|
||||
helpers.getDocument(callback);
|
||||
}
|
||||
|
||||
afterAll(function () {
|
||||
helpers.stopApplication();
|
||||
afterAll(async function () {
|
||||
await helpers.stopApplication();
|
||||
});
|
||||
|
||||
describe("Current weather", function () {
|
||||
|
@@ -5,8 +5,8 @@ describe("Display of modules", function () {
|
||||
helpers.startApplication("tests/configs/modules/display.js");
|
||||
helpers.getDocument(done);
|
||||
});
|
||||
afterAll(function () {
|
||||
helpers.stopApplication();
|
||||
afterAll(async function () {
|
||||
await helpers.stopApplication();
|
||||
});
|
||||
|
||||
it("should show the test header", function () {
|
||||
|
@@ -5,8 +5,8 @@ describe("Position of modules", function () {
|
||||
helpers.startApplication("tests/configs/modules/positions.js");
|
||||
helpers.getDocument(done);
|
||||
});
|
||||
afterAll(function () {
|
||||
helpers.stopApplication();
|
||||
afterAll(async function () {
|
||||
await helpers.stopApplication();
|
||||
});
|
||||
|
||||
const positions = ["top_bar", "top_left", "top_center", "top_right", "upper_third", "middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right", "bottom_bar", "fullscreen_above", "fullscreen_below"];
|
||||
|
@@ -1,4 +1,4 @@
|
||||
const fetch = require("node-fetch");
|
||||
const fetch = require("fetch");
|
||||
const helpers = require("./global-setup");
|
||||
|
||||
describe("port directive configuration", function () {
|
||||
@@ -6,8 +6,8 @@ describe("port directive configuration", function () {
|
||||
beforeAll(function () {
|
||||
helpers.startApplication("tests/configs/port_8090.js");
|
||||
});
|
||||
afterAll(function () {
|
||||
helpers.stopApplication();
|
||||
afterAll(async function () {
|
||||
await helpers.stopApplication();
|
||||
});
|
||||
|
||||
it("should return 200", function (done) {
|
||||
@@ -22,8 +22,8 @@ describe("port directive configuration", function () {
|
||||
beforeAll(function () {
|
||||
helpers.startApplication("tests/configs/port_8090.js", (process.env.MM_PORT = 8100));
|
||||
});
|
||||
afterAll(function () {
|
||||
helpers.stopApplication();
|
||||
afterAll(async function () {
|
||||
await helpers.stopApplication();
|
||||
});
|
||||
|
||||
it("should return 200", function (done) {
|
||||
|
@@ -1,12 +1,12 @@
|
||||
const fetch = require("node-fetch");
|
||||
const fetch = require("fetch");
|
||||
const helpers = require("./global-setup");
|
||||
|
||||
describe("Vendors", function () {
|
||||
beforeAll(function () {
|
||||
helpers.startApplication("tests/configs/default.js");
|
||||
});
|
||||
afterAll(function () {
|
||||
helpers.stopApplication();
|
||||
afterAll(async function () {
|
||||
await helpers.stopApplication();
|
||||
});
|
||||
|
||||
describe("Get list vendors", function () {
|
||||
|
@@ -5,8 +5,8 @@ describe("Check configuration without modules", function () {
|
||||
helpers.startApplication("tests/configs/without_modules.js");
|
||||
helpers.getDocument(done);
|
||||
});
|
||||
afterAll(function () {
|
||||
helpers.stopApplication();
|
||||
afterAll(async function () {
|
||||
await helpers.stopApplication();
|
||||
});
|
||||
|
||||
it("Show the message MagicMirror² title", function () {
|
||||
|
Reference in New Issue
Block a user