25 lines
720 B
JavaScript
Executable File
25 lines
720 B
JavaScript
Executable File
import { JSDOM } from 'jsdom';
|
|
import { configure } from 'enzyme';
|
|
import Adapter from 'enzyme-adapter-react-16';
|
|
|
|
configure({ adapter: new Adapter() });
|
|
global.fetch = require('jest-fetch-mock');
|
|
|
|
const exposedProperties = ['window', 'navigator', 'document'];
|
|
const { document } = new JSDOM('').window;
|
|
global.document = document;
|
|
global.window = document.defaultView;
|
|
global.HTMLElement = window.HTMLElement;
|
|
global.HTMLAnchorElement = window.HTMLAnchorElement;
|
|
|
|
Object.keys(document.defaultView).forEach(property => {
|
|
if (typeof global[property] === 'undefined') {
|
|
exposedProperties.push(property);
|
|
global[property] = document.defaultView[property];
|
|
}
|
|
});
|
|
|
|
global.navigator = {
|
|
userAgent: 'node.js',
|
|
};
|