@@ -195,19 +195,16 @@ describe("SplitPdfHook integration tests check splitted file is same as not spli
195195 } ,
196196 } ) ;
197197
198- expect ( respSplit . elements ?. length ) . toEqual ( respSingle . elements ?. length ) ;
199- expect ( respSplit . contentType ) . toEqual ( respSingle . contentType ) ;
200- expect ( respSplit . statusCode ) . toEqual ( respSingle . statusCode ) ;
201-
198+ expect ( respSplit . length ) . toEqual ( respSingle . length ) ;
202199 // Remove 'parent_id' metadata
203- const splitElements = respSplit . elements ?. map ( ( el ) => ( {
200+ const splitElements = respSplit . map ( ( el ) => ( {
204201 ...el ,
205202 metadata : {
206203 ...el [ 'metadata' ] ,
207204 parent_id : undefined ,
208205 } ,
209206 } ) ) ;
210- const singleElements = respSingle . elements ?. map ( ( el ) => ( {
207+ const singleElements = respSingle . map ( ( el ) => ( {
211208 ...el ,
212209 metadata : {
213210 ...el [ 'metadata' ] ,
@@ -323,9 +320,9 @@ describe("SplitPdfHook integration tests page range parameter", () => {
323320 const filename = "test/data/layout-parser-paper.pdf" ;
324321 const file = { content : readFileSync ( filename ) , fileName : filename } ;
325322
326- let startingPageNumber = 1 ;
323+ const startingPageNumber = 1 ;
327324 try {
328- let response = await client . general . partition ( {
325+ const response = await client . general . partition ( {
329326 partitionParameters : {
330327 files : file ,
331328 strategy : Strategy . Fast ,
@@ -336,7 +333,7 @@ describe("SplitPdfHook integration tests page range parameter", () => {
336333
337334 // Grab the set of page numbers in the result
338335 // Assert that all returned elements are in the expected page range
339- const pageNumbers = new Set ( response ?. elements ?. map ( ( element : any ) => element . metadata . page_number ) ) ;
336+ const pageNumbers = new Set ( response ?. map ( ( element : any ) => element . metadata . page_number ) ) ;
340337 const minPageNumber = expectedPages ?. [ 0 ] ?? 0 + startingPageNumber - 1 ;
341338 const maxPageNumber = expectedPages ?. [ 1 ] ?? 0 + startingPageNumber - 1 ;
342339
@@ -390,8 +387,7 @@ describe("SplitPDF succeeds for large PDF with high concurrency", () => {
390387 } ,
391388 } ) ;
392389
393- expect ( res . statusCode ) . toEqual ( 200 ) ;
394- expect ( res . elements ?. length ) . toBeGreaterThan ( 0 ) ;
390+ expect ( res . length ) . toBeGreaterThan ( 0 ) ;
395391 } ,
396392 300000 ) ;
397393} ) ;
@@ -440,10 +436,9 @@ describe("SplitPDF async can be used to send multiple files concurrently", () =>
440436 ...requestParams
441437 } ,
442438 } ) ;
443- expect ( res . statusCode ) . toEqual ( 200 ) ;
444- expect ( res . elements ?. length ) . toBeGreaterThan ( 0 ) ;
445- if ( res . elements ) {
446- serialElements . push ( res . elements ) ;
439+ expect ( res . length ) . toBeGreaterThan ( 0 ) ;
440+ if ( res ) {
441+ serialElements . push ( res ) ;
447442 }
448443 }
449444
@@ -456,10 +451,9 @@ describe("SplitPDF async can be used to send multiple files concurrently", () =>
456451 ) ) ;
457452
458453 for ( const res of concurrentResponses ) {
459- expect ( res . statusCode ) . toEqual ( 200 ) ;
460- expect ( res . elements ?. length ) . toBeGreaterThan ( 0 ) ;
461- if ( res . elements ) {
462- concurrentElements . push ( res . elements ) ;
454+ expect ( res . length ) . toBeGreaterThan ( 0 ) ;
455+ if ( res ) {
456+ concurrentElements . push ( res ) ;
463457 }
464458 }
465459
0 commit comments