@@ -7,6 +7,8 @@ import {MetadataClient} from "../metadataClient";
77import { TestUtil } from "./utils/test-util" ;
88import { TaskResultStatusEnum } from "../../common/open-api/models/TaskResultStatusEnum" ;
99import { SignalResponse } from "../../common/open-api/models/SignalResponse" ;
10+ import { httpTask } from "../sdk" ;
11+ import { TaskClient } from "../taskClient" ;
1012
1113describe ( "Executor" , ( ) => {
1214 const clientPromise = orkesConductorClient ( { useEnvVars : true } ) ;
@@ -111,6 +113,42 @@ describe("Executor", () => {
111113 const executionDetails = await executor . getWorkflow ( executionId ! , true ) ;
112114 expect ( executionDetails . idempotencyKey ) . toEqual ( idempotencyKey ) ;
113115 } ) ;
116+
117+ test ( "Should run workflow with http task with asyncComplete true" , async ( ) => {
118+ const client = await clientPromise ;
119+ const executor = new WorkflowExecutor ( client ) ;
120+
121+ await executor . registerWorkflow ( true , {
122+ name : "test_jssdk_workflow_with_http_task_with_asyncComplete_true" ,
123+ version : 1 ,
124+ ownerEmail : "developers@orkes.io" ,
125+ tasks : [ httpTask ( "test_jssdk_http_task_with_asyncComplete_true" , { uri : "http://www.yahoo.com" , method : "GET" } , true ) ] ,
126+ inputParameters : [ ] ,
127+ outputParameters : { } ,
128+ timeoutSeconds : 300 ,
129+ } ) ;
130+
131+ const executionId = await executor . startWorkflow ( {
132+ name : "test_jssdk_workflow_with_http_task_with_asyncComplete_true" ,
133+ input : { } ,
134+ version : 1 ,
135+ } ) ;
136+
137+ await new Promise ( resolve => setTimeout ( resolve , 2000 ) ) ;
138+ const workflowStatusBefore = await executor . getWorkflow ( executionId , true ) ;
139+
140+ expect ( workflowStatusBefore . status ) . toEqual ( "RUNNING" ) ;
141+ expect ( workflowStatusBefore . tasks ?. [ 0 ] ?. status ) . toEqual ( "IN_PROGRESS" ) ;
142+
143+ const taskClient = new TaskClient ( client ) ;
144+ taskClient . updateTaskResult ( executionId , "test_jssdk_http_task_with_asyncComplete_true" , "COMPLETED" , { hello : "From manuall api call updating task result" } ) ;
145+
146+ await new Promise ( resolve => setTimeout ( resolve , 2000 ) ) ;
147+ const workflowStatusAfter = await executor . getWorkflow ( executionId , true ) ;
148+
149+ expect ( workflowStatusAfter . status ) . toEqual ( "COMPLETED" ) ;
150+ expect ( workflowStatusAfter . tasks ?. [ 0 ] ?. status ) . toEqual ( "COMPLETED" ) ;
151+ } ) ;
114152} ) ;
115153
116154describe ( "Execute with Return Strategy and Consistency" , ( ) => {
0 commit comments