Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed May 9, 2017
1 parent b9f0347 commit 74500f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
12 changes: 8 additions & 4 deletions superset/assets/spec/helpers/browser.js
Expand Up @@ -4,11 +4,11 @@ import chai from 'chai';
import jsdom from 'jsdom';

require('babel-register')();
global.sinon = require('sinon');

const exposedProperties = ['window', 'navigator', 'document'];

global.document = jsdom.jsdom('');
global.jsdom = jsdom.jsdom;
global.document = global.jsdom('<!doctype html><html><body></body></html>');
global.window = document.defaultView;
Object.keys(document.defaultView).forEach((property) => {
if (typeof global[property] === 'undefined') {
Expand All @@ -25,12 +25,16 @@ global.navigator = {

// Configuration copied from https://github.com/sinonjs/sinon/issues/657
// allowing for sinon.fakeServer to work
global.jsdom = jsdom.jsdom;
global.document = global.jsdom('<!doctype html><html><body></body></html>');

global.window = global.document.defaultView;
global.XMLHttpRequest = global.window.XMLHttpRequest;

global.sinon = require('sinon');

global.expect = chai.expect;
global.assert = chai.assert;

global.sinon.useFakeXMLHttpRequest();

global.window.XMLHttpRequest = global.XMLHttpRequest;
global.$ = require('jquery')(global.window);
Expand Up @@ -60,6 +60,7 @@ describe('AsyncSelect', () => {
<AsyncSelect {...mockedProps} autoSelect />,
);
const spy = sinon.spy(wrapper.instance(), 'onChange');

server.respond();

expect(spy.callCount).to.equal(1);
Expand Down

0 comments on commit 74500f0

Please sign in to comment.