@@ -1194,7 +1194,8 @@ describe('useUpdate', () => {
11941194 />
11951195 ) ;
11961196
1197- fireEvent . change ( screen . getByLabelText ( 'title' ) , {
1197+ fireEvent . click ( await screen . findByText ( 'Hello' ) ) ;
1198+ fireEvent . change ( await screen . findByLabelText ( 'title' ) , {
11981199 target : { value : 'Bazinga' } ,
11991200 } ) ;
12001201 fireEvent . click ( screen . getByText ( 'Save' ) ) ;
@@ -1204,9 +1205,13 @@ describe('useUpdate', () => {
12041205 await waitFor ( ( ) => {
12051206 expect ( middlewareSpy ) . toHaveBeenCalledWith ( 'posts' , {
12061207 id : '1' ,
1207- data : { title : 'Bazinga' } ,
1208+ data : { author : 'John Doe' , id : 1 , title : 'Bazinga' } ,
12081209 meta : undefined ,
1209- previousData : undefined ,
1210+ previousData : {
1211+ author : 'John Doe' ,
1212+ id : 1 ,
1213+ title : 'Bazinga' ,
1214+ } ,
12101215 } ) ;
12111216 } ) ;
12121217 } ) ;
@@ -1220,7 +1225,8 @@ describe('useUpdate', () => {
12201225 />
12211226 ) ;
12221227
1223- fireEvent . change ( screen . getByLabelText ( 'title' ) , {
1228+ fireEvent . click ( await screen . findByText ( 'Hello' ) ) ;
1229+ fireEvent . change ( await screen . findByLabelText ( 'title' ) , {
12241230 target : { value : 'Bazinga' } ,
12251231 } ) ;
12261232 fireEvent . click ( screen . getByText ( 'Save' ) ) ;
@@ -1229,9 +1235,13 @@ describe('useUpdate', () => {
12291235 await waitFor ( ( ) => {
12301236 expect ( middlewareSpy ) . toHaveBeenCalledWith ( 'posts' , {
12311237 id : '1' ,
1232- data : { title : 'Bazinga' } ,
1238+ data : { author : 'John Doe' , id : 1 , title : 'Bazinga' } ,
12331239 meta : undefined ,
1234- previousData : undefined ,
1240+ previousData : {
1241+ author : 'John Doe' ,
1242+ id : 1 ,
1243+ title : 'Bazinga' ,
1244+ } ,
12351245 } ) ;
12361246 } ) ;
12371247 } ) ;
0 commit comments