Skip to content

Commit

Permalink
refactor(bootstrap): DOMParser in boostrap
Browse files Browse the repository at this point in the history
  • Loading branch information
ftoromanoff committed Jan 5, 2024
1 parent b0f6d2d commit a6bf551
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/unit/bootstrap.js
Original file line number Diff line number Diff line change
@@ -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,
};

Expand All @@ -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 = {
Expand Down

0 comments on commit a6bf551

Please sign in to comment.