@@ -2,7 +2,7 @@ import type { ReactNode } from 'react';
22import * as React from 'react' ;
33import { Text } from 'react-native' ;
44
5- import { act , renderHookAsync } from '..' ;
5+ import { act , renderHook } from '..' ;
66import { excludeConsoleMessage } from '../test-utils/console' ;
77
88// eslint-disable-next-line no-console
@@ -18,8 +18,8 @@ function useSuspendingHook(promise: Promise<string>) {
1818 return React . use ( promise ) ;
1919}
2020
21- test ( 'renderHookAsync renders hook asynchronously' , async ( ) => {
22- const { result } = await renderHookAsync ( ( ) => {
21+ test ( 'renderHook renders hook asynchronously' , async ( ) => {
22+ const { result } = await renderHook ( ( ) => {
2323 const [ state , setState ] = React . useState ( 1 ) ;
2424
2525 React . useEffect ( ( ) => {
@@ -32,7 +32,7 @@ test('renderHookAsync renders hook asynchronously', async () => {
3232 expect ( result . current ) . toEqual ( 2 ) ;
3333} ) ;
3434
35- test ( 'renderHookAsync with wrapper option' , async ( ) => {
35+ test ( 'renderHook with wrapper option' , async ( ) => {
3636 const Context = React . createContext ( 'default' ) ;
3737
3838 function useTestHook ( ) {
@@ -43,7 +43,7 @@ test('renderHookAsync with wrapper option', async () => {
4343 return < Context . Provider value = "provided" > { children } </ Context . Provider > ;
4444 }
4545
46- const { result } = await renderHookAsync ( useTestHook , { wrapper : Wrapper } ) ;
46+ const { result } = await renderHook ( useTestHook , { wrapper : Wrapper } ) ;
4747 expect ( result . current ) . toEqual ( 'provided' ) ;
4848} ) ;
4949
@@ -58,12 +58,12 @@ test('rerenderAsync function updates hook asynchronously', async () => {
5858 return state ;
5959 }
6060
61- const { result, rerenderAsync } = await renderHookAsync ( useTestHook , {
61+ const { result, rerender } = await renderHook ( useTestHook , {
6262 initialProps : { value : 5 } ,
6363 } ) ;
6464 expect ( result . current ) . toEqual ( 10 ) ;
6565
66- await rerenderAsync ( { value : 10 } ) ;
66+ await rerender ( { value : 10 } ) ;
6767 expect ( result . current ) . toEqual ( 20 ) ;
6868} ) ;
6969
@@ -80,10 +80,10 @@ test('unmount function unmounts hook asynchronously', async () => {
8080 return 'test' ;
8181 }
8282
83- const { unmountAsync } = await renderHookAsync ( useTestHook ) ;
83+ const { unmount } = await renderHook ( useTestHook ) ;
8484 expect ( cleanupCalled ) . toBe ( false ) ;
8585
86- await unmountAsync ( ) ;
86+ await unmount ( ) ;
8787 expect ( cleanupCalled ) . toBe ( true ) ;
8888} ) ;
8989
@@ -98,7 +98,7 @@ test('handles hook with state updates during effects', async () => {
9898 return count ;
9999 }
100100
101- const { result } = await renderHookAsync ( useTestHook ) ;
101+ const { result } = await renderHook ( useTestHook ) ;
102102 expect ( result . current ) . toBe ( 1 ) ;
103103} ) ;
104104
@@ -115,7 +115,7 @@ test('handles multiple state updates in effects', async () => {
115115 return { first, second } ;
116116 }
117117
118- const { result } = await renderHookAsync ( useTestHook ) ;
118+ const { result } = await renderHook ( useTestHook ) ;
119119 expect ( result . current ) . toEqual ( { first : 10 , second : 20 } ) ;
120120} ) ;
121121
@@ -125,7 +125,7 @@ test('handles hook with suspense', async () => {
125125 resolvePromise = resolve ;
126126 } ) ;
127127
128- const { result } = await renderHookAsync ( useSuspendingHook , {
128+ const { result } = await renderHook ( useSuspendingHook , {
129129 initialProps : promise ,
130130 wrapper : ( { children } ) => (
131131 < React . Suspense fallback = { < Text > Loading...</ Text > } > { children } </ React . Suspense >
@@ -168,7 +168,7 @@ test('handles hook suspense with error boundary', async () => {
168168 rejectPromise = reject ;
169169 } ) ;
170170
171- const { result } = await renderHookAsync ( useSuspendingHook , {
171+ const { result } = await renderHook ( useSuspendingHook , {
172172 initialProps : promise ,
173173 wrapper : ( { children } ) => (
174174 < ErrorBoundary fallback = "error-fallback" >
@@ -206,7 +206,7 @@ test('handles custom hooks with complex logic', async () => {
206206 return { count, increment, decrement, reset } ;
207207 }
208208
209- const { result } = await renderHookAsync ( useCounter , { initialProps : 5 } ) ;
209+ const { result } = await renderHook ( useCounter , { initialProps : 5 } ) ;
210210 expect ( result . current . count ) . toBe ( 5 ) ;
211211
212212 // eslint-disable-next-line require-await
@@ -247,20 +247,20 @@ test('handles hook with cleanup and re-initialization', async () => {
247247 return value ;
248248 }
249249
250- const { result, rerenderAsync , unmountAsync } = await renderHookAsync ( useTestHook , {
250+ const { result, rerender , unmount } = await renderHook ( useTestHook , {
251251 initialProps : { key : 'initial' } ,
252252 } ) ;
253253
254254 expect ( result . current ) . toBe ( 'initial-effect' ) ;
255255 expect ( effectCount ) . toBe ( 1 ) ;
256256 expect ( cleanupCount ) . toBe ( 0 ) ;
257257
258- await rerenderAsync ( { key : 'updated' } ) ;
258+ await rerender ( { key : 'updated' } ) ;
259259 expect ( result . current ) . toBe ( 'updated-effect' ) ;
260260 expect ( effectCount ) . toBe ( 2 ) ;
261261 expect ( cleanupCount ) . toBe ( 1 ) ;
262262
263- await unmountAsync ( ) ;
263+ await unmount ( ) ;
264264 expect ( effectCount ) . toBe ( 2 ) ;
265265 expect ( cleanupCount ) . toBe ( 2 ) ;
266266} ) ;
0 commit comments