Skip to content

Commit aeab69a

Browse files
huntiefabriziocucci
authored andcommitted
Move RefreshControlMock into Jest preset files (#51530)
Summary: Pull Request resolved: #51530 Alternative to #50784. `__mocks__` (and other underscored dirs) are correctly excluded from our npm package via `package.json#files`. But in this instance, this is a source file for the `jest/` directory (Jest preset within `react-native`), and should be included — fix by relocating. Changelog: [General][Fixed] - Fix missing RefreshControlMock source in Jest preset Reviewed By: rshest Differential Revision: D75215731 fbshipit-source-id: 1240344c4236288f31b16513f4df16766ad1e571
1 parent 6f3948f commit aeab69a

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,29 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @format
87
* @flow strict-local
8+
* @format
99
*/
1010

1111
'use strict';
1212

13-
import type {HostComponent} from '../../../../src/private/types/HostComponent';
13+
import type {HostComponent} from '../src/private/types/HostComponent';
1414

15-
import requireNativeComponent from '../../../ReactNative/requireNativeComponent';
15+
import requireNativeComponent from '../Libraries/ReactNative/requireNativeComponent';
1616
import * as React from 'react';
1717

1818
const RCTRefreshControl: HostComponent<{}> = requireNativeComponent<{}>(
1919
'RCTRefreshControl',
2020
);
2121

22-
class RefreshControlMock extends React.Component<{...}> {
22+
export default class RefreshControlMock extends React.Component<{...}> {
2323
static latestRef: ?RefreshControlMock;
24+
25+
render(): React.Node {
26+
return <RCTRefreshControl />;
27+
}
28+
2429
componentDidMount() {
2530
RefreshControlMock.latestRef = this;
2631
}
27-
render(): React.MixedElement {
28-
return <RCTRefreshControl />;
29-
}
3032
}
31-
32-
module.exports = RefreshControlMock;

packages/react-native/jest/setup.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,7 @@ jest
201201
}))
202202
.mock('../Libraries/Components/RefreshControl/RefreshControl', () => ({
203203
__esModule: true,
204-
default: jest.requireActual(
205-
'../Libraries/Components/RefreshControl/__mocks__/RefreshControlMock',
206-
),
204+
default: jest.requireActual('./RefreshControlMock').default,
207205
}))
208206
.mock('../Libraries/Components/ScrollView/ScrollView', () => {
209207
const baseComponent = mockComponent(

0 commit comments

Comments
 (0)