mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
refactor tests in 3 categories unit, e2e and electron
This commit is contained in:
29
tests/electron/modules/basic-auth.js
Normal file
29
tests/electron/modules/basic-auth.js
Normal file
@@ -0,0 +1,29 @@
|
||||
const path = require("path");
|
||||
const auth = require("express-basic-auth");
|
||||
const express = require("express");
|
||||
const app = express();
|
||||
|
||||
const basicAuth = auth({
|
||||
realm: "MagicMirror Area restricted.",
|
||||
users: { MagicMirror: "CallMeADog" }
|
||||
});
|
||||
|
||||
app.use(basicAuth);
|
||||
|
||||
// Set available directories
|
||||
const directories = ["/tests/configs"];
|
||||
const rootPath = path.resolve(__dirname + "/../../");
|
||||
|
||||
for (let directory of directories) {
|
||||
app.use(directory, express.static(path.resolve(rootPath + directory)));
|
||||
}
|
||||
|
||||
let server;
|
||||
|
||||
exports.listen = function () {
|
||||
server = app.listen.apply(app, arguments);
|
||||
};
|
||||
|
||||
exports.close = function (callback) {
|
||||
server.close(callback);
|
||||
};
|
Reference in New Issue
Block a user