diff --git a/test/unit/bootstrap.js b/test/unit/bootstrap.js index 1888912a22..ce8d60963d 100644 --- a/test/unit/bootstrap.js +++ b/test/unit/bootstrap.js @@ -1,9 +1,15 @@ /* eslint-disable max-classes-per-file */ +import fetch from 'node-fetch'; import { Camera } from 'three'; +import { DOMParser } from 'xmldom'; global.window = { addEventListener: () => {}, removeEventListener: () => {}, + DOMParser: () => { + const domParser = new DOMParser(); + return { parseFromString: (file, type) => domParser.parseFromString(file, type) }; + }, setTimeout, }; @@ -18,6 +24,8 @@ global.URL = function URL(url) { global.Event = () => {}; global.requestAnimationFrame = () => {}; +global.fetch = fetch; +global.fetch.Promise = Promise; // this could be replaced by jsdom.Navigator in https://github.com/iTowns/itowns/pull/1412 global.navigator = {