Reformat all files with prettier

This commit is contained in:
Pieter Vander Vennet 2022-09-08 21:40:48 +02:00
parent e22d189376
commit b541d3eab4
382 changed files with 50893 additions and 35566 deletions

View file

@ -1,32 +1,41 @@
import ScriptUtils from "../scripts/ScriptUtils";
import {Utils} from "../Utils";
import ScriptUtils from "../scripts/ScriptUtils"
import { Utils } from "../Utils"
import * as fakedom from "fake-dom"
import Locale from "../UI/i18n/Locale";
import Locale from "../UI/i18n/Locale"
export const mochaHooks = {
beforeEach(done) {
ScriptUtils.fixUtils();
ScriptUtils.fixUtils()
Locale.language.setData("en")
if (fakedom === undefined || window === undefined) {
throw "FakeDom not initialized"
}
// Block internet access
const realDownloadFunc = Utils.externalDownloadFunction;
const realDownloadFunc = Utils.externalDownloadFunction
Utils.externalDownloadFunction = async (url) => {
console.error("Fetching ", url, "blocked in tests, use Utils.injectJsonDownloadForTests")
console.error(
"Fetching ",
url,
"blocked in tests, use Utils.injectJsonDownloadForTests"
)
const data = await realDownloadFunc(url)
console.log("\n\n ----------- \nBLOCKED DATA\n Utils.injectJsonDownloadForTests(\n" +
" ", JSON.stringify(url), ", \n",
" ", JSON.stringify(data), "\n )\n------------------\n\n")
throw new Error("Detected internet access for URL " + url + ", please inject it with Utils.injectJsonDownloadForTests")
console.log(
"\n\n ----------- \nBLOCKED DATA\n Utils.injectJsonDownloadForTests(\n" + " ",
JSON.stringify(url),
", \n",
" ",
JSON.stringify(data),
"\n )\n------------------\n\n"
)
throw new Error(
"Detected internet access for URL " +
url +
", please inject it with Utils.injectJsonDownloadForTests"
)
}
done();
}
}
done()
},
}