21 lines
461 B
JavaScript
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); |