Skip to content

Instantly share code, notes, and snippets.

@bkonkle
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bkonkle/07f2ea72295c0f4350ed to your computer and use it in GitHub Desktop.
Save bkonkle/07f2ea72295c0f4350ed to your computer and use it in GitHub Desktop.
(function() {
'use strict';
var CastawayApp, React, ReactTestUtils, chai, document, jsdom, sinon, sinonChai, window, xhr;
chai = require('chai');
jsdom = require('jsdom');
sinon = require('sinon');
sinonChai = require('sinon-chai');
CastawayApp = require('../../components/CastawayApp');
chai.should();
chai.use(sinonChai);
document = null;
React = null;
ReactTestUtils = null;
window = null;
xhr = null;
describe('CastawayApp', function() {
before(function() {
return global.XMLHttpRequest = function() {
return xhr;
};
});
beforeEach(function() {
xhr = {
open: sinon.spy(),
send: sinon.spy(),
setRequestHeader: sinon.spy()
};
global.window = jsdom.jsdom().createWindow('<html><body></body></html>');
global.document = global.window.document;
global.navigator = global.window.navigator;
React = require('react');
return ReactTestUtils = require('react/lib/ReactTestUtils');
});
after(function() {
delete global.document;
delete global.window;
return delete global.XMLHttpRequest;
});
return describe('#render()', function() {
return it('renders a div with some text', function() {
var result;
return result = ReactTestUtils.renderIntoDocument(CastawayApp(), global.document.body);
});
});
});
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment