Skip to content

Instantly share code, notes, and snippets.

@NiGhTTraX
Created February 5, 2017 15:08
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 NiGhTTraX/cb8ecd2d25beff6cf26bb09f55e25e4e to your computer and use it in GitHub Desktop.
Save NiGhTTraX/cb8ecd2d25beff6cf26bb09f55e25e4e to your computer and use it in GitHub Desktop.
function createSpy() {
const _renderSpy = sinon.spy();
return class Spy extends Component {
static get lastProps() {
return _renderSpy.args[_renderSpy.callCount - 1][0];
}
render() {
_renderSpy(this.props);
return <div>I am a fake component, here to spy on you!</div>;
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment