@@ -111,9 +111,13 @@ describe('WorkflowBlockHandler', () => {
111111 'parent-workflow-id_sub_child-workflow-id_workflow-block-1'
112112 )
113113
114- await expect ( handler . execute ( mockBlock , inputs , mockContext ) ) . rejects . toThrow (
115- 'Error in child workflow "child-workflow-id": Cyclic workflow dependency detected: parent-workflow-id_sub_child-workflow-id_workflow-block-1'
116- )
114+ const result = await handler . execute ( mockBlock , inputs , mockContext )
115+ expect ( result ) . toEqual ( {
116+ success : false ,
117+ error :
118+ 'Cyclic workflow dependency detected: parent-workflow-id_sub_child-workflow-id_workflow-block-1' ,
119+ childWorkflowName : 'child-workflow-id' ,
120+ } )
117121 } )
118122
119123 it ( 'should enforce maximum depth limit' , async ( ) => {
@@ -126,9 +130,12 @@ describe('WorkflowBlockHandler', () => {
126130 'level1_sub_level2_sub_level3_sub_level4_sub_level5_sub_level6_sub_level7_sub_level8_sub_level9_sub_level10_sub_level11' ,
127131 }
128132
129- await expect ( handler . execute ( mockBlock , inputs , deepContext ) ) . rejects . toThrow (
130- 'Error in child workflow "child-workflow-id": Maximum workflow nesting depth of 10 exceeded'
131- )
133+ const result = await handler . execute ( mockBlock , inputs , deepContext )
134+ expect ( result ) . toEqual ( {
135+ success : false ,
136+ error : 'Maximum workflow nesting depth of 10 exceeded' ,
137+ childWorkflowName : 'child-workflow-id' ,
138+ } )
132139 } )
133140
134141 it ( 'should handle child workflow not found' , async ( ) => {
@@ -140,19 +147,25 @@ describe('WorkflowBlockHandler', () => {
140147 statusText : 'Not Found' ,
141148 } )
142149
143- await expect ( handler . execute ( mockBlock , inputs , mockContext ) ) . rejects . toThrow (
144- 'Error in child workflow "non-existent-workflow": Child workflow non-existent-workflow not found'
145- )
150+ const result = await handler . execute ( mockBlock , inputs , mockContext )
151+ expect ( result ) . toEqual ( {
152+ success : false ,
153+ error : 'Child workflow non-existent-workflow not found' ,
154+ childWorkflowName : 'non-existent-workflow' ,
155+ } )
146156 } )
147157
148158 it ( 'should handle fetch errors gracefully' , async ( ) => {
149159 const inputs = { workflowId : 'child-workflow-id' }
150160
151161 mockFetch . mockRejectedValueOnce ( new Error ( 'Network error' ) )
152162
153- await expect ( handler . execute ( mockBlock , inputs , mockContext ) ) . rejects . toThrow (
154- 'Error in child workflow "child-workflow-id": Child workflow child-workflow-id not found'
155- )
163+ const result = await handler . execute ( mockBlock , inputs , mockContext )
164+ expect ( result ) . toEqual ( {
165+ success : false ,
166+ error : 'Child workflow child-workflow-id not found' ,
167+ childWorkflowName : 'child-workflow-id' ,
168+ } )
156169 } )
157170 } )
158171
0 commit comments