mapcomplete/test/testhooks.ts
2024-09-10 14:44:25 +02:00

17 lines
632 B
TypeScript

import ScriptUtils from "../scripts/ScriptUtils"
import { Utils } from "../src/Utils"
import Locale from "../src/UI/i18n/Locale"
import { beforeEach } from "vitest"
import { ReferencingWaysMetaTagger } from "../src/Logic/SimpleMetaTagger"
beforeEach(async () => {
ScriptUtils.fixUtils()
Locale.language.setData("en")
ReferencingWaysMetaTagger.enabled = false
// Block internet access
Utils.externalDownloadFunction = async (url) => {
console.trace("Fetching external data during tests:", url)
throw "Fetching " + url + " blocked in tests, use Utils.injectJsonDownloadForTests instead"
}
})