setupTests.js 515 B

123456789101112131415
  1. import { jsdom } from 'jsdom';
  2. import Enzyme from 'enzyme';
  3. import Adapter from 'enzyme-adapter-react-15';
  4. Enzyme.configure({ adapter: new Adapter() });
  5. // fixed jsdom miss
  6. const documentHTML = '<!doctype html><html><body><div id="root"></div></body></html>';
  7. global.document = jsdom(documentHTML);
  8. global.window = document.defaultView;
  9. global.navigator = global.window.navigator;
  10. global.requestAnimationFrame = global.requestAnimationFrame || function requestAnimationFrame(cb) {
  11. return setTimeout(cb, 0);
  12. };