@@ -13,6 +13,12 @@ afterEach(() => {
1313 console . error = originalConsoleError ;
1414} ) ;
1515
16+ function useSuspendingHook ( promise : Promise < string > ) {
17+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
18+ // @ts -ignore: React 18 does not have `use` hook
19+ return React . use ( promise ) ;
20+ }
21+
1622test ( 'renderHookAsync renders hook asynchronously' , async ( ) => {
1723 const { result } = await renderHookAsync ( ( ) => {
1824 const [ state , setState ] = React . useState ( 1 ) ;
@@ -124,10 +130,6 @@ test('handles multiple state updates in effects', async () => {
124130} ) ;
125131
126132testGateReact19 ( 'handles hook with suspense' , async ( ) => {
127- function useSuspendingHook ( promise : Promise < string > ) {
128- return React . use ( promise ) ;
129- }
130-
131133 let resolvePromise : ( value : string ) => void ;
132134 const promise = new Promise < string > ( ( resolve ) => {
133135 resolvePromise = resolve ;
@@ -169,10 +171,6 @@ testGateReact19('handles hook suspense with error boundary', async () => {
169171 // eslint-disable-next-line no-console
170172 console . error = excludeConsoleMessage ( console . error , ERROR_MESSAGE ) ;
171173
172- function useSuspendingHook ( promise : Promise < string > ) {
173- return React . use ( promise ) ;
174- }
175-
176174 let rejectPromise : ( error : Error ) => void ;
177175 const promise = new Promise < string > ( ( _resolve , reject ) => {
178176 rejectPromise = reject ;
0 commit comments