闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
711 B

  1. import chai from 'chai';
  2. import chaiEnzyme from 'chai-enzyme';
  3. chai.use(chaiEnzyme());
  4. /**
  5. * http://airbnb.io/enzyme/docs/guides/jsdom.html
  6. */
  7. var jsdom = require('jsdom').jsdom;
  8. var exposedProperties = ['window', 'navigator', 'document'];
  9. global.document = jsdom('');
  10. global.window = document.defaultView;
  11. Object.keys(document.defaultView).forEach((property) => {
  12. if (typeof global[property] === 'undefined') {
  13. exposedProperties.push(property);
  14. global[property] = document.defaultView[property];
  15. }
  16. });
  17. global.navigator = {
  18. userAgent: 'node.js'
  19. };
  20. var React = window.React = global.React = require('react');
  21. var ReactDOM = window.ReactDOM = global.ReactDOM = require('react-dom');