Created
September 11, 2019 05:23
-
-
Save overengineered/235da2153f3fd50e17f3e49e73d1c6df 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
const mockAsBasicComponent = (name) => { | |
const React = require('react'); | |
const RealComponent = require.requireActual(name); | |
const BasicComponent = {[name]: props => React.createElement(name, props)}[name]; | |
BasicComponent.propTypes = RealComponent.propTypes; | |
return BasicComponent; | |
} | |
jest.mock('TouchableOpacity', () => mockAsBasicComponent('TouchableOpacity')); | |
jest.mock('Switch', () => mockAsBasicComponent('Switch')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment