This repository has been archived on 2018-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
arbor-frontend/test/test_helper.js

21 lines
461 B
JavaScript
Raw Permalink Normal View History

2016-06-17 13:48:18 -04:00
/**
* Fakes a browser environment for testing react
*/
import jsdom from 'jsdom';
import chai from 'chai';
import chaiImmutable from 'chai-immutable';
const doc = jsdom.jsdom('<!DOCTYPE html><html><body></body></html>');
const win = doc.defaultView;
global.document = doc;
global.window = win;
// Hoist window properties to global
Object.keys(window).forEach(key => {
if ( ! (key in global)) {
global[key] = window[key];
}
});
chai.use(chaiImmutable);