Created
November 15, 2016 17:07
-
-
Save johnthepink/6013b83693693232ecc45138ecd40914 to your computer and use it in GitHub Desktop.
Mocking Mixin Class Methods
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
const MockHeaderAction = (Component) => ( | |
class MockHeaderAction extends React.Component { | |
constructor () { | |
super(...arguments); | |
this.headerAction = jest.fn(); | |
} | |
render() { | |
return <Component { ...this.props } { ...this.state } /> | |
} | |
} | |
); | |
const generateComponent = (additionalProps = {}) => { | |
const newProps = { | |
...defaultProps, | |
...additionalProps, | |
}; | |
const MockedDevotions = MockHeaderAction(Devotions); | |
return <MockedDevotions { ...newProps } />; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment