setupTests.js 515 Bytes
Newer Older
偏右's avatar
偏右 committed
1
import { jsdom } from 'jsdom';
afc163's avatar
afc163 committed
2 3 4 5
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-15';

Enzyme.configure({ adapter: new Adapter() });
偏右's avatar
偏右 committed
6 7 8 9 10 11 12 13 14 15

// fixed jsdom miss
const documentHTML = '<!doctype html><html><body><div id="root"></div></body></html>';
global.document = jsdom(documentHTML);
global.window = document.defaultView;
global.navigator = global.window.navigator;

global.requestAnimationFrame = global.requestAnimationFrame || function requestAnimationFrame(cb) {
  return setTimeout(cb, 0);
};