Skip to content

Commit

Permalink
use doMock
Browse files Browse the repository at this point in the history
  • Loading branch information
aksonov committed May 29, 2018
1 parent 300999d commit 92c3ff1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion __tests__/utils/mockMap.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// from https://github.com/react-community/react-native-maps/issues/889#issuecomment-300637902

jest.mock('react-native-maps', () => {
jest.doMock('react-native-maps', () => {
const React = require.requireActual('react')
const MapView = require.requireActual('react-native-maps')

Expand Down
16 changes: 8 additions & 8 deletions __tests__/utils/mockTextInput.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// mock autofocus: https://github.com/facebook/jest/issues/3707#issuecomment-311169259
export default jest.mock('TextInput', () => {
const RealComponent = require.requireActual('TextInput');
const React = require('React');
export default jest.doMock('TextInput', () => {
const RealComponent = require.requireActual('TextInput')
const React = require('React')
class TextInput extends React.Component {
render() {
delete this.props.autoFocus;
return React.createElement('TextInput', this.props, this.props.children);
delete this.props.autoFocus
return React.createElement('TextInput', this.props, this.props.children)
}
}
TextInput.propTypes = RealComponent.propTypes;
return TextInput;
});
TextInput.propTypes = RealComponent.propTypes
return TextInput
})
16 changes: 8 additions & 8 deletions __tests__/utils/mockVirtualizedList.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
jest.mock('VirtualizedList', () => {
const RealComponent = require.requireActual('VirtualizedList');
const React2 = require('React');
jest.doMock('VirtualizedList', () => {
const RealComponent = require.requireActual('VirtualizedList')
const React2 = require('React')
class VirtualizedList extends React2.Component {
render() {
delete this.props.getScrollableNode;
return React2.createElement('VirtualizedList', this.props, this.props.children);
delete this.props.getScrollableNode
return React2.createElement('VirtualizedList', this.props, this.props.children)
}
}
VirtualizedList.propTypes = RealComponent.propTypes;
return VirtualizedList;
});
VirtualizedList.propTypes = RealComponent.propTypes
return VirtualizedList
})
4 changes: 2 additions & 2 deletions __tests__/utils/testSetup.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
global.window = global
jest.mock('mobx-react/native', () => require('mobx-react/custom'))
jest.mock('Linking', () => {
jest.doMock('mobx-react/native', () => require('mobx-react/custom'))
jest.doMock('Linking', () => {
return {
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
Expand Down

0 comments on commit 92c3ff1

Please sign in to comment.