@@ -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,38 @@ 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+ const workflowStatusBefore = await TestUtil . waitForWorkflowStatus ( executor , executionId , "RUNNING" ) ;
138+
139+ expect ( [ "IN_PROGRESS" , "SCHEDULED" ] ) . toContain ( workflowStatusBefore . tasks ?. [ 0 ] ?. status ) ;
140+
141+ const taskClient = new TaskClient ( client ) ;
142+ taskClient . updateTaskResult ( executionId , "test_jssdk_http_task_with_asyncComplete_true" , "COMPLETED" , { hello : "From manuall api call updating task result" } ) ;
143+
144+ const workflowStatusAfter = await TestUtil . waitForWorkflowStatus ( executor , executionId , "COMPLETED" ) ;
145+
146+ expect ( workflowStatusAfter . tasks ?. [ 0 ] ?. status ) . toEqual ( "COMPLETED" ) ;
147+ } ) ;
114148} ) ;
115149
116150describe ( "Execute with Return Strategy and Consistency" , ( ) => {
0 commit comments