@@ -13,8 +13,8 @@ import {
1313describe ( 'EditBase' , ( ) => {
1414 it ( 'should give access to the save function' , async ( ) => {
1515 const dataProvider = testDataProvider ( {
16- // @ts -ignore
1716 getOne : ( ) =>
17+ // @ts -ignore
1818 Promise . resolve ( { data : { id : 12 , test : 'previous' } } ) ,
1919 update : jest . fn ( ( _ , { id, data, previousData } ) =>
2020 Promise . resolve ( { data : { id, ...previousData , ...data } } )
@@ -44,8 +44,8 @@ describe('EditBase', () => {
4444
4545 it ( 'should allow to override the onSuccess function' , async ( ) => {
4646 const dataProvider = testDataProvider ( {
47- // @ts -ignore
4847 getOne : ( ) =>
48+ // @ts -ignore
4949 Promise . resolve ( { data : { id : 12 , test : 'previous' } } ) ,
5050 update : jest . fn ( ( _ , { id, data, previousData } ) =>
5151 Promise . resolve ( { data : { id, ...previousData , ...data } } )
@@ -75,7 +75,9 @@ describe('EditBase', () => {
7575 {
7676 id : 12 ,
7777 data : { test : 'test' } ,
78+ previousData : { id : 12 , test : 'previous' } ,
7879 resource : 'posts' ,
80+ meta : undefined ,
7981 } ,
8082 { snapshot : [ ] }
8183 ) ;
@@ -84,8 +86,8 @@ describe('EditBase', () => {
8486
8587 it ( 'should allow to override the onSuccess function at call time' , async ( ) => {
8688 const dataProvider = testDataProvider ( {
87- // @ts -ignore
8889 getOne : ( ) =>
90+ // @ts -ignore
8991 Promise . resolve ( { data : { id : 12 , test : 'previous' } } ) ,
9092 update : jest . fn ( ( _ , { id, data, previousData } ) =>
9193 Promise . resolve ( { data : { id, ...previousData , ...data } } )
@@ -117,7 +119,9 @@ describe('EditBase', () => {
117119 {
118120 id : 12 ,
119121 data : { test : 'test' } ,
122+ previousData : { id : 12 , test : 'previous' } ,
120123 resource : 'posts' ,
124+ meta : undefined ,
121125 } ,
122126 { snapshot : [ ] }
123127 ) ;
@@ -128,10 +132,9 @@ describe('EditBase', () => {
128132 it ( 'should allow to override the onError function' , async ( ) => {
129133 jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
130134 const dataProvider = testDataProvider ( {
131- // @ts -ignore
132135 getOne : ( ) =>
136+ // @ts -ignore
133137 Promise . resolve ( { data : { id : 12 , test : 'previous' } } ) ,
134- // @ts -ignore
135138 update : jest . fn ( ( ) => Promise . reject ( { message : 'test' } ) ) ,
136139 } ) ;
137140 const onError = jest . fn ( ) ;
@@ -153,7 +156,9 @@ describe('EditBase', () => {
153156 {
154157 id : 12 ,
155158 data : { test : 'test' } ,
159+ previousData : { id : 12 , test : 'previous' } ,
156160 resource : 'posts' ,
161+ meta : undefined ,
157162 } ,
158163 { snapshot : [ ] }
159164 ) ;
@@ -162,10 +167,9 @@ describe('EditBase', () => {
162167
163168 it ( 'should allow to override the onError function at call time' , async ( ) => {
164169 const dataProvider = testDataProvider ( {
165- // @ts -ignore
166170 getOne : ( ) =>
171+ // @ts -ignore
167172 Promise . resolve ( { data : { id : 12 , test : 'previous' } } ) ,
168- // @ts -ignore
169173 update : jest . fn ( ( ) => Promise . reject ( { message : 'test' } ) ) ,
170174 } ) ;
171175 const onError = jest . fn ( ) ;
@@ -189,7 +193,9 @@ describe('EditBase', () => {
189193 {
190194 id : 12 ,
191195 data : { test : 'test' } ,
196+ previousData : { id : 12 , test : 'previous' } ,
192197 resource : 'posts' ,
198+ meta : undefined ,
193199 } ,
194200 { snapshot : [ ] }
195201 ) ;
@@ -199,8 +205,8 @@ describe('EditBase', () => {
199205
200206 it ( 'should allow to override the transform function' , async ( ) => {
201207 const dataProvider = testDataProvider ( {
202- // @ts -ignore
203208 getOne : ( ) =>
209+ // @ts -ignore
204210 Promise . resolve ( { data : { id : 12 , test : 'previous' } } ) ,
205211 update : jest . fn ( ( _ , { id, data, previousData } ) =>
206212 Promise . resolve ( { data : { id, ...previousData , ...data } } )
@@ -239,8 +245,8 @@ describe('EditBase', () => {
239245
240246 it ( 'should allow to override the transform function at call time' , async ( ) => {
241247 const dataProvider = testDataProvider ( {
242- // @ts -ignore
243248 getOne : ( ) =>
249+ // @ts -ignore
244250 Promise . resolve ( { data : { id : 12 , test : 'previous' } } ) ,
245251 update : jest . fn ( ( _ , { id, data, previousData } ) =>
246252 Promise . resolve ( { data : { id, ...previousData , ...data } } )
0 commit comments