1+ import { before , beforeEach , describe , it } from "node:test" ;
12import assert from "node:assert/strict" ;
23import path from "node:path" ;
34
@@ -37,7 +38,7 @@ function checkEmptyActiveOptions(inference: ExtractionInference) {
3738 assert . equal ( inference . activeOptions ?. textContext , false ) ;
3839}
3940
40- describe ( "MindeeV2 – Integration - Client" , ( ) => {
41+ describe ( "MindeeV2 – Integration - Client" , { timeout : 120000 } , ( ) => {
4142 let client : Client ;
4243 let modelId : string ;
4344
@@ -98,7 +99,7 @@ describe("MindeeV2 – Integration - Client", () => {
9899 assert . ok ( inference . result ) ;
99100 assert . equal ( inference . result . rawText , undefined ) ;
100101 checkEmptyActiveOptions ( inference ) ;
101- } ) . timeout ( 60000 ) ;
102+ } ) ;
102103
103104 it ( "enqueueAndGetResult must succeed: Filled, single-page image – PathInput" , async ( ) => {
104105 const source = new PathInput ( { inputPath : sampleImagePath } ) ;
@@ -137,7 +138,7 @@ describe("MindeeV2 – Integration - Client", () => {
137138 assert . equal ( inference . activeOptions ?. textContext , true ) ;
138139
139140 assert . equal ( inference . result . rawText ?. pages . length , 1 ) ;
140- } ) . timeout ( 120000 ) ;
141+ } ) ;
141142
142143 it ( "enqueueAndGetResult must succeed: Filled, single-page image – Base64Input" , async ( ) => {
143144 const data = fs . readFileSync ( sampleBase64Path , "utf8" ) ;
@@ -168,7 +169,7 @@ describe("MindeeV2 – Integration - Client", () => {
168169 assert . equal ( supplierField . value , "Clachan" ) ;
169170
170171 checkEmptyActiveOptions ( inference ) ;
171- } ) . timeout ( 120000 ) ;
172+ } ) ;
172173
173174 it ( "enqueue must raise 422: Invalid model ID" , async ( ) => {
174175 const source = new PathInput ( { inputPath : emptyPdfPath } ) ;
@@ -180,7 +181,7 @@ describe("MindeeV2 – Integration - Client", () => {
180181 } catch ( err ) {
181182 check422 ( err ) ;
182183 }
183- } ) . timeout ( 60000 ) ;
184+ } ) ;
184185
185186 it ( "getResult must raise 422: Invalid job ID" , async ( ) => {
186187 try {
@@ -192,7 +193,35 @@ describe("MindeeV2 – Integration - Client", () => {
192193 } catch ( err ) {
193194 check422 ( err ) ;
194195 }
195- } ) . timeout ( 60000 ) ;
196+ } ) ;
197+
198+ it ( "enqueue, getJob, and getResult must succeed" , async ( ) => {
199+ const source = new PathInput ( { inputPath : emptyPdfPath } ) ;
200+ const params = {
201+ modelId,
202+ rag : false ,
203+ rawText : false ,
204+ polygon : false ,
205+ confidence : false ,
206+ alias : "ts_integration_all_together"
207+ } ;
208+
209+ const enqueueResponse = await client . enqueue (
210+ Extraction , source , params
211+ ) ;
212+ assert . ok ( enqueueResponse . job . id ) ;
213+
214+ setTimeout ( async ( ) => {
215+ const jobResponse = await client . getJob ( enqueueResponse . job . id ) ;
216+ assert . ok ( jobResponse . job . resultUrl ) ;
217+
218+ const resultId = jobResponse . job . resultUrl ?. split ( "/" ) . pop ( ) || "" ;
219+ const resultResponse = await client . getResult (
220+ Extraction , resultId
221+ ) ;
222+ assert . strictEqual ( resultId , resultResponse . inference . id ) ;
223+ } , 6500 ) ;
224+ } ) ;
196225
197226 it ( "enqueueAndGetResult must succeed: HTTPS URL" , async ( ) => {
198227 const url = process . env . MINDEE_V2_SE_TESTS_BLANK_PDF_URL ?? "error-no-url-found" ;
@@ -211,7 +240,7 @@ describe("MindeeV2 – Integration - Client", () => {
211240 ) ;
212241 assert . ok ( response ) ;
213242 assert . ok ( response . inference instanceof ExtractionInference ) ;
214- } ) . timeout ( 60000 ) ;
243+ } ) ;
215244
216245 it ( "should override the data schema successfully" , async ( ) => {
217246 const source = new PathInput ( { inputPath : emptyPdfPath } ) ;
@@ -233,6 +262,6 @@ describe("MindeeV2 – Integration - Client", () => {
233262 assert . ok ( response . inference . result . fields . get ( "test_replace" ) ) ;
234263 assert . equal ( ( response . inference . result . fields . get ( "test_replace" ) as SimpleField ) . value , "a test value" ) ;
235264
236- } ) . timeout ( 60000 ) ;
265+ } ) ;
237266
238267} ) ;
0 commit comments