@@ -111,13 +111,9 @@ describe('WorkflowBlockHandler', () => {
111111 'parent-workflow-id_sub_child-workflow-id_workflow-block-1'
112112 )
113113
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- } )
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+ )
121117 } )
122118
123119 it ( 'should enforce maximum depth limit' , async ( ) => {
@@ -130,12 +126,9 @@ describe('WorkflowBlockHandler', () => {
130126 'level1_sub_level2_sub_level3_sub_level4_sub_level5_sub_level6_sub_level7_sub_level8_sub_level9_sub_level10_sub_level11' ,
131127 }
132128
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- } )
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+ )
139132 } )
140133
141134 it ( 'should handle child workflow not found' , async ( ) => {
@@ -147,25 +140,19 @@ describe('WorkflowBlockHandler', () => {
147140 statusText : 'Not Found' ,
148141 } )
149142
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- } )
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+ )
156146 } )
157147
158148 it ( 'should handle fetch errors gracefully' , async ( ) => {
159149 const inputs = { workflowId : 'child-workflow-id' }
160150
161151 mockFetch . mockRejectedValueOnce ( new Error ( 'Network error' ) )
162152
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- } )
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+ )
169156 } )
170157 } )
171158
0 commit comments