@@ -168,86 +168,6 @@ describe('api', () => {
168168 } ) ,
169169 ) . rejects . toThrow ( '`transformation.region` must be provided at client instantiation before calling this method.' ) ;
170170 } ) ;
171-
172- test ( 'exposes the transformation methods at the root of the client' , async ( ) => {
173- const ingestionClient = algoliasearch ( 'APP_ID' , 'API_KEY' , {
174- requester : browserEchoRequester ( ) ,
175- transformation : { region : 'us' } ,
176- } ) ;
177-
178- expect ( ingestionClient . saveObjectsWithTransformation ) . not . toBeUndefined ( ) ;
179-
180- let res = ( await ingestionClient . saveObjectsWithTransformation ( {
181- indexName : 'foo' ,
182- objects : [ { objectID : 'bar' , baz : 42 } ] ,
183- waitForTasks : true ,
184- } ) ) as unknown as EchoResponse ;
185-
186- expect ( res . headers ) . toEqual (
187- expect . objectContaining ( {
188- 'x-algolia-application-id' : 'APP_ID' ,
189- 'x-algolia-api-key' : 'API_KEY' ,
190- } ) ,
191- ) ;
192- expect ( res . url . startsWith ( 'https://data.us.algolia.com/1/push/foo?watch=true' ) ) . toBeTruthy ( ) ;
193- expect ( res . data ) . toEqual ( {
194- action : 'addObject' ,
195- records : [
196- {
197- baz : 42 ,
198- objectID : 'bar' ,
199- } ,
200- ] ,
201- } ) ;
202- expect ( ingestionClient . partialUpdateObjectsWithTransformation ) . not . toBeUndefined ( ) ;
203-
204- res = ( await ingestionClient . partialUpdateObjectsWithTransformation ( {
205- indexName : 'foo' ,
206- objects : [ { objectID : 'bar' , baz : 42 } ] ,
207- waitForTasks : true ,
208- createIfNotExists : true ,
209- } ) ) as unknown as EchoResponse ;
210-
211- expect ( res . headers ) . toEqual (
212- expect . objectContaining ( {
213- 'x-algolia-application-id' : 'APP_ID' ,
214- 'x-algolia-api-key' : 'API_KEY' ,
215- } ) ,
216- ) ;
217- expect ( res . url . startsWith ( 'https://data.us.algolia.com/1/push/foo?watch=true' ) ) . toBeTruthy ( ) ;
218- expect ( res . data ) . toEqual ( {
219- action : 'partialUpdateObject' ,
220- records : [
221- {
222- baz : 42 ,
223- objectID : 'bar' ,
224- } ,
225- ] ,
226- } ) ;
227-
228- res = ( await ingestionClient . partialUpdateObjectsWithTransformation ( {
229- indexName : 'foo' ,
230- objects : [ { objectID : 'bar' , baz : 42 } ] ,
231- waitForTasks : true ,
232- } ) ) as unknown as EchoResponse ;
233-
234- expect ( res . headers ) . toEqual (
235- expect . objectContaining ( {
236- 'x-algolia-application-id' : 'APP_ID' ,
237- 'x-algolia-api-key' : 'API_KEY' ,
238- } ) ,
239- ) ;
240- expect ( res . url . startsWith ( 'https://data.us.algolia.com/1/push/foo?watch=true' ) ) . toBeTruthy ( ) ;
241- expect ( res . data ) . toEqual ( {
242- action : 'partialUpdateObjectNoCreate' ,
243- records : [
244- {
245- baz : 42 ,
246- objectID : 'bar' ,
247- } ,
248- ] ,
249- } ) ;
250- } ) ;
251171 } ) ;
252172} ) ;
253173
0 commit comments