Last active
August 29, 2015 14:01
-
-
Save bkonkle/07f2ea72295c0f4350ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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