const fs = require("fs");
const path = require("path");
const chai = require("chai");
const expect = chai.expect;
const mlog = require("mocha-logger");
const translations = require("../../translations/translations.js");
const helmet = require("helmet");
const {JSDOM} = require("jsdom");
const express = require("express");
describe("Translations", function() {
let server;
before(function() {
const app = express();
app.use(helmet());
app.use(function (req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
next();
});
app.use("/translations", express.static(path.join(__dirname, "..", "..", "translations")));
server = app.listen(3000);
});
after(function() {
server.close();
});
it("should have a translation file in the specified path", function() {
for(let language in translations) {
const file = fs.statSync(translations[language]);
expect(file.isFile()).to.be.equal(true);
}
});
const mmm = {
name: "TranslationTest",
file(file) {
return `http://localhost:3000/${file}`;
}
};
describe("Parsing language files through the Translator class", function() {
for(let language in translations) {
it(`should parse ${language}`, function(done) {
const dom = new JSDOM(`\
\
\