This commit is contained in:
Karsten Hassel
2021-09-23 22:52:32 +02:00
parent 60f8de282d
commit 54b04962a8
5 changed files with 49 additions and 55 deletions

View File

@@ -1,3 +1,5 @@
const jsdom = require("jsdom");
exports.startApplication = function (configFilename, exec) {
jest.resetModules();
// Set config sample for use in test
@@ -14,3 +16,12 @@ exports.stopApplication = function (app) {
app.stop();
}
};
exports.getDocument = function (url, callback) {
jsdom.JSDOM.fromURL(url, { resources: "usable", runScripts: "dangerously" }).then((dom) => {
dom.window.onload = function () {
global.document = dom.window.document;
callback();
};
});
};