mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-03-27 22:56:07 +08:00
Restore jest-setup.js file
This commit is contained in:
28
packages/react-navigation/jest-setup.js
vendored
Normal file
28
packages/react-navigation/jest-setup.js
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* @flow
|
||||
* eslint-env jest
|
||||
*/
|
||||
|
||||
// See https://github.com/facebook/jest/issues/2208
|
||||
jest.mock('Linking', () => ({
|
||||
addEventListener: jest.fn(),
|
||||
removeEventListener: jest.fn(),
|
||||
openURL: jest.fn(),
|
||||
canOpenURL: jest.fn(),
|
||||
getInitialURL: jest
|
||||
.fn()
|
||||
.mockImplementation((value: string) => Promise.resolve(value)),
|
||||
}));
|
||||
|
||||
// See https://github.com/facebook/react-native/issues/11659
|
||||
jest.mock('ScrollView', () => {
|
||||
// $FlowExpectedError
|
||||
const RealComponent = require.requireActual('ScrollView');
|
||||
class ScrollView extends RealComponent {
|
||||
scrollTo = () => {};
|
||||
}
|
||||
return ScrollView;
|
||||
});
|
||||
|
||||
// $FlowExpectedError
|
||||
Date.now = jest.fn(() => 0);
|
||||
Reference in New Issue
Block a user