21 lines
455 B
JavaScript
21 lines
455 B
JavaScript
import jsdom from 'jsdom';
|
|
import chai from 'chai';
|
|
import sinonChai from 'sinon-chai';
|
|
|
|
// Jsdom document & window
|
|
const doc = jsdom.jsdom('<!doctype html><html><body></body></html>');
|
|
const win = doc.defaultView;
|
|
|
|
// Add to global
|
|
global.document = doc;
|
|
global.window = win;
|
|
|
|
// Add window keys to global window
|
|
Object.keys(window).forEach((key) => {
|
|
if (!(key in global)) {
|
|
global[key] = window[key];
|
|
}
|
|
});
|
|
|
|
chai.expect();
|
|
chai.use(sinonChai);
|