mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-22 05:07:05 +00:00
Cleanup test directory (#2937)
Moves files around and renames some so that the structure is cleaner and more consistent
This commit is contained in:
29
tests/e2e/helpers/basic-auth.js
Normal file
29
tests/e2e/helpers/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", "/tests/mocks"];
|
||||
const rootPath = path.resolve(__dirname + "/../../../");
|
||||
|
||||
for (let directory of directories) {
|
||||
app.use(directory, express.static(path.resolve(rootPath + directory)));
|
||||
}
|
||||
|
||||
let server;
|
||||
|
||||
exports.listen = (...args) => {
|
||||
server = app.listen.apply(app, args);
|
||||
};
|
||||
|
||||
exports.close = async () => {
|
||||
await server.close();
|
||||
};
|
Reference in New Issue
Block a user