11import * as React from 'react' ;
2- import { fireEvent , render , screen } from '@testing-library/react' ;
32import { act } from 'react-dom/test-utils' ;
3+ import { fireEvent , render , screen } from '@testing-library/react' ;
44
55import useTreeChanges from '../src' ;
66
@@ -24,7 +24,7 @@ function WithState() {
2424 isReady : false ,
2525 milestones : [ ] ,
2626 } ) ;
27- const { added, changed, filled , removed , emptied } = useTreeChanges ( state ) ;
27+ const { added, changed, emptied , filled , removed } = useTreeChanges ( state ) ;
2828
2929 React . useEffect ( ( ) => {
3030 setTimeout ( ( ) => {
@@ -77,7 +77,7 @@ function WithState() {
7777 if ( emptied ( 'milestones' ) ) {
7878 mockState ( 'emptied:milestones' ) ;
7979 }
80- } , [ changed , state ] ) ;
80+ } , [ added , changed , emptied , filled , removed , state ] ) ;
8181
8282 const handleClickCount = ( ) => {
8383 setState ( s => ( { ...s , count : s . count + 1 } ) ) ;
@@ -87,7 +87,9 @@ function WithState() {
8787 < div data-testid = "app" >
8888 < header >
8989 < h1 > tree-changes</ h1 >
90- < button onClick = { handleClickCount } > Clicked { state . count } times</ button >
90+ < button onClick = { handleClickCount } type = "button" >
91+ Clicked { state . count } times
92+ </ button >
9193 { state . isReady ? < p > side-effect is complete</ p > : < p > loading...</ p > }
9294 </ header >
9395 </ div >
0 commit comments