Skip to content

Commit a5c106c

Browse files
committed
flatten testGateReact19
1 parent 2a7f330 commit a5c106c

File tree

6 files changed

+13
-40
lines changed

6 files changed

+13
-40
lines changed

eslint.config.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ export default [
5050
'react-native-a11y/has-valid-accessibility-ignores-invert-colors': 'off',
5151
'react-native-a11y/has-valid-accessibility-value': 'off',
5252
'@typescript-eslint/no-explicit-any': 'off',
53-
'jest/no-standalone-expect': ['error', { additionalTestBlockFunctions: ['testGateReact19'] }],
5453
},
5554
},
5655
];

src/__tests__/react-native-api.test.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ import { FlatList, Image, Modal, ScrollView, Switch, Text, TextInput, View } fro
44
import { render, screen } from '..';
55
import { mapJsonProps } from '../test-utils/json';
66

7-
const isReact19 = React.version.startsWith('19.');
8-
const testGateReact19 = isReact19 ? test : test.skip;
9-
107
/**
118
* Tests in this file are intended to give us an proactive warning that React Native behavior has
129
* changed in a way that may impact our code like queries or event handling.
@@ -239,7 +236,7 @@ test('React Native API assumption: <FlatList> renders a single host <ScrollView>
239236
`);
240237
});
241238

242-
testGateReact19('React Native API assumption: <Modal> renders a single host element', () => {
239+
test('React Native API assumption: <Modal> renders a single host element', () => {
243240
render(
244241
<Modal testID="test">
245242
<Text>Modal Content</Text>

src/__tests__/render-hook-async.test.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import { Text } from 'react-native';
55
import { act, renderHookAsync } from '..';
66
import { excludeConsoleMessage } from '../test-utils/console';
77

8-
const testGateReact19 = React.version.startsWith('19.') ? test : test.skip;
9-
108
// eslint-disable-next-line no-console
119
const originalConsoleError = console.error;
1210
afterEach(() => {
@@ -121,7 +119,7 @@ test('handles multiple state updates in effects', async () => {
121119
expect(result.current).toEqual({ first: 10, second: 20 });
122120
});
123121

124-
testGateReact19('handles hook with suspense', async () => {
122+
test('handles hook with suspense', async () => {
125123
let resolvePromise: (value: string) => void;
126124
const promise = new Promise<string>((resolve) => {
127125
resolvePromise = resolve;
@@ -160,7 +158,7 @@ class ErrorBoundary extends React.Component<
160158
}
161159
}
162160

163-
testGateReact19('handles hook suspense with error boundary', async () => {
161+
test('handles hook suspense with error boundary', async () => {
164162
const ERROR_MESSAGE = 'Hook Promise Rejected In Test';
165163
// eslint-disable-next-line no-console
166164
console.error = excludeConsoleMessage(console.error, ERROR_MESSAGE);

src/__tests__/render-hook.test.tsx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -84,20 +84,3 @@ test('props type is inferred correctly when initial props is explicitly undefine
8484
rerender(6);
8585
expect(result.current.param).toBe(6);
8686
});
87-
88-
/**
89-
* This test makes sure that calling renderHook does
90-
* not try to detect host component names in any form.
91-
* But since there are numerous methods that could trigger that
92-
* we check the count of renders using React Test Renderers.
93-
*/
94-
test('does render only once', () => {
95-
jest.spyOn(UniversalTestRenderer, 'createRoot');
96-
97-
renderHook(() => {
98-
const [state, setState] = React.useState(1);
99-
return [state, setState];
100-
});
101-
102-
expect(UniversalTestRenderer.createRoot).toHaveBeenCalledTimes(1);
103-
});

src/__tests__/suspense-fake-timers.test.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import { excludeConsoleMessage } from '../test-utils/console';
66

77
jest.useFakeTimers();
88

9-
const testGateReact19 = React.version.startsWith('19.') ? test : test.skip;
10-
119
// eslint-disable-next-line no-console
1210
const originalConsoleError = console.error;
1311
afterEach(() => {
@@ -22,7 +20,7 @@ function Suspending({ promise, testID }: { promise: Promise<unknown>; testID: st
2220
return <View testID={testID} />;
2321
}
2422

25-
testGateReact19('resolves manually-controlled promise', async () => {
23+
test('resolves manually-controlled promise', async () => {
2624
let resolvePromise: (value: unknown) => void;
2725
const promise = new Promise((resolve) => {
2826
resolvePromise = resolve;
@@ -47,7 +45,7 @@ testGateReact19('resolves manually-controlled promise', async () => {
4745
expect(screen.queryByText('Loading...')).not.toBeOnTheScreen();
4846
});
4947

50-
testGateReact19('resolves timer-controlled promise', async () => {
48+
test('resolves timer-controlled promise', async () => {
5149
const promise = new Promise((resolve) => {
5250
setTimeout(() => resolve(null), 100);
5351
});
@@ -88,7 +86,7 @@ class ErrorBoundary extends React.Component<
8886
}
8987
}
9088

91-
testGateReact19('handles promise rejection with error boundary', async () => {
89+
test('handles promise rejection with error boundary', async () => {
9290
const ERROR_MESSAGE = 'Promise Rejected In Test';
9391
// eslint-disable-next-line no-console
9492
console.error = excludeConsoleMessage(console.error, ERROR_MESSAGE);
@@ -117,7 +115,7 @@ testGateReact19('handles promise rejection with error boundary', async () => {
117115
expect(screen.queryByTestId('error-content')).not.toBeOnTheScreen();
118116
});
119117

120-
testGateReact19('handles multiple suspending components', async () => {
118+
test('handles multiple suspending components', async () => {
121119
let resolvePromise1: (value: unknown) => void;
122120
let resolvePromise2: (value: unknown) => void;
123121

@@ -154,7 +152,7 @@ testGateReact19('handles multiple suspending components', async () => {
154152
expect(screen.queryByText('Loading...')).not.toBeOnTheScreen();
155153
});
156154

157-
testGateReact19('handles multiple suspense boundaries independently', async () => {
155+
test('handles multiple suspense boundaries independently', async () => {
158156
let resolvePromise1: (value: unknown) => void;
159157
let resolvePromise2: (value: unknown) => void;
160158

src/__tests__/suspense.test.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import { Text, View } from 'react-native';
44
import { act, renderAsync, screen } from '..';
55
import { excludeConsoleMessage } from '../test-utils/console';
66

7-
const testGateReact19 = React.version.startsWith('19.') ? test : test.skip;
8-
97
// eslint-disable-next-line no-console
108
const originalConsoleError = console.error;
119
afterEach(() => {
@@ -20,7 +18,7 @@ function Suspending({ promise, testID }: { promise: Promise<unknown>; testID: st
2018
return <View testID={testID} />;
2119
}
2220

23-
testGateReact19('resolves manually-controlled promise', async () => {
21+
test('resolves manually-controlled promise', async () => {
2422
let resolvePromise: (value: unknown) => void;
2523
const promise = new Promise((resolve) => {
2624
resolvePromise = resolve;
@@ -45,7 +43,7 @@ testGateReact19('resolves manually-controlled promise', async () => {
4543
expect(screen.queryByText('Loading...')).not.toBeOnTheScreen();
4644
});
4745

48-
testGateReact19('resolves timer-controlled promise', async () => {
46+
test('resolves timer-controlled promise', async () => {
4947
const promise = new Promise((resolve) => {
5048
setTimeout(() => resolve(null), 100);
5149
});
@@ -85,7 +83,7 @@ class ErrorBoundary extends React.Component<
8583
}
8684
}
8785

88-
testGateReact19('handles promise rejection with error boundary', async () => {
86+
test('handles promise rejection with error boundary', async () => {
8987
const ERROR_MESSAGE = 'Promise Rejected In Test';
9088
// eslint-disable-next-line no-console
9189
console.error = excludeConsoleMessage(console.error, ERROR_MESSAGE);
@@ -114,7 +112,7 @@ testGateReact19('handles promise rejection with error boundary', async () => {
114112
expect(screen.queryByTestId('error-content')).not.toBeOnTheScreen();
115113
});
116114

117-
testGateReact19('handles multiple suspending components', async () => {
115+
test('handles multiple suspending components', async () => {
118116
let resolvePromise1: (value: unknown) => void;
119117
let resolvePromise2: (value: unknown) => void;
120118

@@ -151,7 +149,7 @@ testGateReact19('handles multiple suspending components', async () => {
151149
expect(screen.queryByText('Loading...')).not.toBeOnTheScreen();
152150
});
153151

154-
testGateReact19('handles multiple suspense boundaries independently', async () => {
152+
test('handles multiple suspense boundaries independently', async () => {
155153
let resolvePromise1: (value: unknown) => void;
156154
let resolvePromise2: (value: unknown) => void;
157155

0 commit comments

Comments
 (0)