Created
May 19, 2015 16:16
-
-
Save jhollingworth/08b4832bee7889b7d72a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class User extends React.Component { | |
render() { | |
return ( | |
<a href="#" ref="goHome" onClick={this.goHome}> | |
Go Home | |
</a> | |
); | |
} | |
goHome() { | |
this.context.router.transitionTo('home'); | |
} | |
} | |
User.contextTypes = { router: React.PropTypes.object }; | |
let transitionTo = sinon.stub(); | |
let user = testTree(<User />, { | |
context: { | |
router: { | |
transitionTo: transitionTo | |
} | |
} | |
}); | |
user.goHome.click(); | |
expect(transitionTo).to.be.calledWith('dashboard'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Isn't line 26 meant to read:
expect(transitionTo).to.be.calledWith('home');
?