@@ -195,19 +195,16 @@ describe("SplitPdfHook integration tests check splitted file is same as not spli
195
195
} ,
196
196
} ) ;
197
197
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 ) ;
202
199
// Remove 'parent_id' metadata
203
- const splitElements = respSplit . elements ?. map ( ( el ) => ( {
200
+ const splitElements = respSplit . map ( ( el ) => ( {
204
201
...el ,
205
202
metadata : {
206
203
...el [ 'metadata' ] ,
207
204
parent_id : undefined ,
208
205
} ,
209
206
} ) ) ;
210
- const singleElements = respSingle . elements ?. map ( ( el ) => ( {
207
+ const singleElements = respSingle . map ( ( el ) => ( {
211
208
...el ,
212
209
metadata : {
213
210
...el [ 'metadata' ] ,
@@ -323,9 +320,9 @@ describe("SplitPdfHook integration tests page range parameter", () => {
323
320
const filename = "test/data/layout-parser-paper.pdf" ;
324
321
const file = { content : readFileSync ( filename ) , fileName : filename } ;
325
322
326
- let startingPageNumber = 1 ;
323
+ const startingPageNumber = 1 ;
327
324
try {
328
- let response = await client . general . partition ( {
325
+ const response = await client . general . partition ( {
329
326
partitionParameters : {
330
327
files : file ,
331
328
strategy : Strategy . Fast ,
@@ -336,7 +333,7 @@ describe("SplitPdfHook integration tests page range parameter", () => {
336
333
337
334
// Grab the set of page numbers in the result
338
335
// 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 ) ) ;
340
337
const minPageNumber = expectedPages ?. [ 0 ] ?? 0 + startingPageNumber - 1 ;
341
338
const maxPageNumber = expectedPages ?. [ 1 ] ?? 0 + startingPageNumber - 1 ;
342
339
@@ -390,8 +387,7 @@ describe("SplitPDF succeeds for large PDF with high concurrency", () => {
390
387
} ,
391
388
} ) ;
392
389
393
- expect ( res . statusCode ) . toEqual ( 200 ) ;
394
- expect ( res . elements ?. length ) . toBeGreaterThan ( 0 ) ;
390
+ expect ( res . length ) . toBeGreaterThan ( 0 ) ;
395
391
} ,
396
392
300000 ) ;
397
393
} ) ;
@@ -440,10 +436,9 @@ describe("SplitPDF async can be used to send multiple files concurrently", () =>
440
436
...requestParams
441
437
} ,
442
438
} ) ;
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 ) ;
447
442
}
448
443
}
449
444
@@ -456,10 +451,9 @@ describe("SplitPDF async can be used to send multiple files concurrently", () =>
456
451
) ) ;
457
452
458
453
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 ) ;
463
457
}
464
458
}
465
459
0 commit comments