I have a simple react component where I have an onClick event which redirects to another page - the Google search engine (for testing purposes).
Here's the JSFiddle link for the React component - http://ift.tt/29sKJ5Z
describe('Events', function () {
it('should have click event state', function (done) {
var events = Events();
ReactTestUtils.renderIntoDocument(events);
ReactTestUtils.Simulate.click(events.refs.button.getDOMNode());
//Test to see if the page redirects to correct url?
done();
});
});
How can I test that the browser was redirected to the correct url? Should I be mocking window.location.href? Or is there something else ?
Aucun commentaire:
Enregistrer un commentaire