@@ -622,7 +622,7 @@ describe('processAgentFileUpload', () => {
622622
623623 await expect (
624624 processAgentFileUpload ( { req, res : mockRes , metadata : makeMetadata ( ) } ) ,
625- ) . rejects . toThrow ( / i m a g e - b a s e d a n d r e q u i r e s a n O C R s e r v i c e / ) ;
625+ ) . rejects . toThrow ( 'No text found in document' ) ;
626626
627627 expect ( parseText ) . not . toHaveBeenCalled ( ) ;
628628 } ) ;
@@ -632,8 +632,11 @@ describe('processAgentFileUpload', () => {
632632 handleFileUpload : jest . fn ( ) . mockRejectedValue ( new Error ( 'PRIVATE parser failure' ) ) ,
633633 } ) ;
634634 extractInspectableFileText . mockImplementationOnce ( async ( { extract } ) => {
635- await extract ( ) ;
636- throw makeUninspectableExtractedTextError ( ) ;
635+ try {
636+ await extract ( ) ;
637+ } catch {
638+ throw makeUninspectableExtractedTextError ( ) ;
639+ }
637640 } ) ;
638641 const req = makeReq ( {
639642 mimetype : PDF_MIME ,
@@ -771,7 +774,7 @@ describe('processAgentFileUpload', () => {
771774
772775 await expect (
773776 processAgentFileUpload ( { req, res : mockRes , metadata : makeMetadata ( ) } ) ,
774- ) . rejects . toThrow ( / i m a g e - b a s e d a n d r e q u i r e s a n O C R s e r v i c e / ) ;
777+ ) . rejects . toThrow ( 'failure' ) ;
775778
776779 expect ( parseText ) . not . toHaveBeenCalled ( ) ;
777780 } ) ;
@@ -862,8 +865,11 @@ describe('processAgentFileUpload', () => {
862865 handleFileUpload : jest . fn ( ) . mockRejectedValue ( new Error ( 'PRIVATE parser failure' ) ) ,
863866 } ) ;
864867 extractInspectableFileText . mockImplementationOnce ( async ( { extract } ) => {
865- await extract ( ) ;
866- throw makeUninspectableExtractedTextError ( ) ;
868+ try {
869+ await extract ( ) ;
870+ } catch {
871+ throw makeUninspectableExtractedTextError ( ) ;
872+ }
867873 } ) ;
868874 const req = makeReq ( {
869875 mimetype : DOCX_MIME ,
0 commit comments