import React , { useState , useEffect } from 'react' ; import { View } from '..' ; import { act } from '../testUtils' ; import { render } from './helpers' ; describe ( 'AdaptorInstance' , ( ) => { test ( 'works for mock adaptor config' , ( ) => { let renderedCount ; let renderedSetCount ; let effectCount ; const App = ( ) => { const [ count , setCount ] = useState ( 0 ) ; [ renderedCount , renderedSetCount ] = [ count , setCount ] ; useEffect ( ( ) => { effectCount = count ; } , [ count ] ) ; return < View > count is { count } < /View>; } ; act ( ( ) => { render ( < App />); } ) ; expect ( renderedCount ) . toBe ( 0 ) ; expect ( effectCount ) . toBe ( 0 ) ; act ( ( ) => { renderedSetCount ( 10 ) ; renderedSetCount ( 20 ) ; } ) ; expect ( renderedCount ) . toBe ( 20 ) ; expect ( effectCount ) . toBe ( 20 ) ; } ) ; } ) ;