Skip to content

Commit 8ed8efc

Browse files
fix: fix RN nightly tests by removing RNGH tests (#1905)
1 parent 2923d11 commit 8ed8efc

7 files changed

Lines changed: 168 additions & 209 deletions

File tree

jest.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ module.exports = {
33
setupFilesAfterEnv: ['./jest-setup.ts'],
44
testPathIgnorePatterns: ['build/', 'examples/', 'experiments-app/', 'codemods/'],
55
testTimeout: 60000,
6-
transformIgnorePatterns: [
7-
'/node_modules/(?!(@react-native|react-native|react-native-gesture-handler)/).*/',
8-
],
6+
transformIgnorePatterns: ['/node_modules/(?!(@react-native|react-native)/).*/'],
97
snapshotSerializers: ['@relmify/jest-serializer-strip-ansi/always'],
108
clearMocks: true,
119
collectCoverageFrom: [

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@
9696
"prettier": "^3.8.2",
9797
"react": "19.2.3",
9898
"react-native": "0.85.0",
99-
"react-native-gesture-handler": "^2.31.1",
10099
"release-it": "^19.2.4",
101100
"test-renderer": "1.2.0",
102101
"tsx": "^4.21.0",

src/__tests__/fire-event.test.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,35 @@ describe('fireEvent.press', () => {
152152
await fireEvent.press(screen.getByTestId('subject'));
153153
expect(onPress).toHaveBeenCalled();
154154
});
155+
156+
test('works with testOnly_onPress handlers', async () => {
157+
const onPress = jest.fn();
158+
const onPressIn = jest.fn();
159+
const onPressOut = jest.fn();
160+
const onLongPress = jest.fn();
161+
const testOnlyPressProps = {
162+
testOnly_onPress: onPress,
163+
testOnly_onPressIn: onPressIn,
164+
testOnly_onPressOut: onPressOut,
165+
testOnly_onLongPress: onLongPress,
166+
};
167+
168+
await render(<View testID="subject" {...testOnlyPressProps} />);
169+
170+
const subject = screen.getByTestId('subject');
171+
172+
await fireEvent.press(subject);
173+
expect(onPress).toHaveBeenCalledTimes(1);
174+
175+
await fireEvent(subject, 'pressIn');
176+
expect(onPressIn).toHaveBeenCalledTimes(1);
177+
178+
await fireEvent(subject, 'pressOut');
179+
expect(onPressOut).toHaveBeenCalledTimes(1);
180+
181+
await fireEvent(subject, 'longPress');
182+
expect(onLongPress).toHaveBeenCalledTimes(1);
183+
});
155184
});
156185

157186
describe('fireEvent.changeText', () => {

src/__tests__/react-native-gesture-handler.test.tsx

Lines changed: 0 additions & 65 deletions
This file was deleted.

src/user-event/press/__tests__/longPress.test.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { Pressable, Text, TouchableHighlight, TouchableOpacity } from 'react-native';
2+
import { Pressable, Text, TouchableHighlight, TouchableOpacity, View } from 'react-native';
33

44
import { render, screen } from '../../..';
55
import { createEventLogger, getEventsNames } from '../../../test-utils/events';
@@ -74,6 +74,22 @@ describe('userEvent.longPress with fake timers', () => {
7474
expect(getEventsNames(events)).toEqual(['pressIn', 'longPress', 'pressOut']);
7575
});
7676

77+
test('works with testOnly_onPress handlers', async () => {
78+
const { events, logEvent } = createEventLogger();
79+
const user = userEvent.setup();
80+
const testOnlyPressProps = {
81+
testOnly_onPress: logEvent('press'),
82+
testOnly_onPressIn: logEvent('pressIn'),
83+
testOnly_onPressOut: logEvent('pressOut'),
84+
testOnly_onLongPress: logEvent('longPress'),
85+
};
86+
87+
await render(<View testID="subject" {...testOnlyPressProps} />);
88+
89+
await user.longPress(screen.getByTestId('subject'));
90+
expect(getEventsNames(events)).toEqual(['pressIn', 'longPress', 'pressOut']);
91+
});
92+
7793
test('calls onLongPress if the delayLongPress is the default one', async () => {
7894
const { logEvent, events } = createEventLogger();
7995
const user = userEvent.setup();

src/user-event/press/__tests__/press.test.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,22 @@ describe('userEvent.press with fake timers', () => {
9797
expect(getEventsNames(events)).toEqual(['pressIn', 'pressOut']);
9898
});
9999

100+
test('works with testOnly_onPress handlers', async () => {
101+
const { events, logEvent } = createEventLogger();
102+
const user = userEvent.setup();
103+
const testOnlyPressProps = {
104+
testOnly_onPress: logEvent('press'),
105+
testOnly_onPressIn: logEvent('pressIn'),
106+
testOnly_onPressOut: logEvent('pressOut'),
107+
testOnly_onLongPress: logEvent('longPress'),
108+
};
109+
110+
await render(<View testID="subject" {...testOnlyPressProps} />);
111+
112+
await user.press(screen.getByTestId('subject'));
113+
expect(getEventsNames(events)).toEqual(['pressIn', 'pressOut', 'press']);
114+
});
115+
100116
test('works on Button', async () => {
101117
const { events, logEvent } = createEventLogger();
102118

0 commit comments

Comments
 (0)