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

/**
* 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);