11import * as React from 'react' ;
22import { Pressable , Text , TextInput , View } from 'react-native' ;
33
4- import type { RenderAPI } from '../..' ;
54import { deprecated_renderSync , fireEvent , screen } from '../..' ;
65
76const PLACEHOLDER_FRESHNESS = 'Add custom freshness' ;
@@ -87,14 +86,14 @@ test('rerender', async () => {
8786 await fireEvent . press ( screen . getByText ( 'Change freshness!' ) ) ;
8887 expect ( fn ) . toHaveBeenCalledTimes ( 1 ) ;
8988
90- screen . rerender ( < Banana onUpdate = { fn } /> ) ;
89+ void screen . rerender ( < Banana onUpdate = { fn } /> ) ;
9190 expect ( fn ) . toHaveBeenCalledTimes ( 2 ) ;
9291} ) ;
9392
9493test ( 'unmount' , ( ) => {
9594 const fn = jest . fn ( ) ;
9695 deprecated_renderSync ( < Banana onUnmount = { fn } /> ) ;
97- screen . unmount ( ) ;
96+ void screen . unmount ( ) ;
9897 expect ( fn ) . toHaveBeenCalled ( ) ;
9998} ) ;
10099
@@ -107,7 +106,7 @@ test('unmount should handle cleanup functions', () => {
107106
108107 deprecated_renderSync ( < Component /> ) ;
109108
110- screen . unmount ( ) ;
109+ void screen . unmount ( ) ;
111110
112111 expect ( cleanup ) . toHaveBeenCalledTimes ( 1 ) ;
113112} ) ;
@@ -149,7 +148,7 @@ test('renders options.wrapper around updated node', () => {
149148 wrapper : WrapperComponent ,
150149 } ) ;
151150
152- screen . rerender ( < View testID = "inner" accessibilityLabel = "test" accessibilityHint = "test" /> ) ;
151+ void screen . rerender ( < View testID = "inner" accessibilityLabel = "test" accessibilityHint = "test" /> ) ;
153152
154153 expect ( screen . getByTestId ( 'wrapper' ) ) . toBeTruthy ( ) ;
155154 expect ( screen ) . toMatchInlineSnapshot ( `
@@ -174,8 +173,10 @@ test('returns host root', () => {
174173} ) ;
175174
176175test ( 'RenderAPI type' , ( ) => {
177- deprecated_renderSync ( < Banana /> ) as RenderAPI ;
178- expect ( true ) . toBeTruthy ( ) ;
176+ // This test verifies that deprecated_renderSync returns a compatible type
177+ // Note: deprecated_renderSync has different method signatures (sync vs async)
178+ const result = deprecated_renderSync ( < Banana /> ) ;
179+ expect ( result ) . toBeTruthy ( ) ;
179180} ) ;
180181
181182test ( 'returned output can be spread using rest operator' , ( ) => {
@@ -184,30 +185,3 @@ test('returned output can be spread using rest operator', () => {
184185 const { rerender, ...rest } = deprecated_renderSync ( < View testID = "test" /> ) ;
185186 expect ( rest ) . toBeTruthy ( ) ;
186187} ) ;
187-
188- test ( 'rerenderAsync updates the component asynchronously' , async ( ) => {
189- const fn = jest . fn ( ) ;
190- const result = deprecated_renderSync ( < Banana onUpdate = { fn } /> ) ;
191-
192- await result . rerenderAsync ( < Banana onUpdate = { fn } /> ) ;
193-
194- expect ( fn ) . toHaveBeenCalledTimes ( 1 ) ;
195- } ) ;
196-
197- test ( 'updateAsync is an alias for rerenderAsync' , async ( ) => {
198- const fn = jest . fn ( ) ;
199- const result = deprecated_renderSync ( < Banana onUpdate = { fn } /> ) ;
200-
201- await result . updateAsync ( < Banana onUpdate = { fn } /> ) ;
202-
203- expect ( fn ) . toHaveBeenCalledTimes ( 1 ) ;
204- } ) ;
205-
206- test ( 'unmountAsync unmounts the component asynchronously' , async ( ) => {
207- const fn = jest . fn ( ) ;
208- const result = deprecated_renderSync ( < Banana onUnmount = { fn } /> ) ;
209-
210- await result . unmountAsync ( ) ;
211-
212- expect ( fn ) . toHaveBeenCalled ( ) ;
213- } ) ;
0 commit comments