@@ -430,6 +430,27 @@ describe('apiClient.automation', () => {
430
430
} )
431
431
} )
432
432
433
+ describe ( 'stopFlowInstanceExecution' , ( ) => {
434
+ it ( 'should make POST request to stop flow instance execution' , async ( ) => {
435
+ mockSuccessAPIRequest ( successResult )
436
+
437
+ const result = await automationAPI . stopFlowInstanceExecution ( appId , flowId , versionId , executionId )
438
+
439
+ expect ( result ) . toEqual ( successResult )
440
+ expect ( apiRequestCalls ( ) ) . toEqual ( [
441
+ {
442
+ path : `http://test-host:3000/api/app/${ appId } /automation/flow/${ flowId } /version/${ versionId } /instances/${ executionId } /stop` ,
443
+ body : undefined ,
444
+ method : 'POST' ,
445
+ encoding : 'utf8' ,
446
+ headers : { } ,
447
+ timeout : 0 ,
448
+ withCredentials : false
449
+ }
450
+ ] )
451
+ } )
452
+ } )
453
+
433
454
describe ( 'cleanFlowVersionAnalytics' , ( ) => {
434
455
it ( 'should make DELETE request to clean flow version analytics' , async ( ) => {
435
456
mockSuccessAPIRequest ( successResult )
@@ -868,27 +889,6 @@ describe('apiClient.automation', () => {
868
889
} )
869
890
870
891
describe ( 'AI Assistant Methods' , ( ) => {
871
- describe ( 'getAllowedAIModels' , ( ) => {
872
- it ( 'should make GET request to get allowed AI models' , async ( ) => {
873
- mockSuccessAPIRequest ( successResult )
874
-
875
- const result = await automationAPI . getAllowedAIModels ( appId )
876
-
877
- expect ( result ) . toEqual ( successResult )
878
- expect ( apiRequestCalls ( ) ) . toEqual ( [
879
- {
880
- path : `http://test-host:3000/api/app/${ appId } /automation/ai/assistants/allowed-models` ,
881
- body : undefined ,
882
- method : 'GET' ,
883
- encoding : 'utf8' ,
884
- headers : { } ,
885
- timeout : 0 ,
886
- withCredentials : false
887
- }
888
- ] )
889
- } )
890
- } )
891
-
892
892
describe ( 'registerAIAssistant' , ( ) => {
893
893
it ( 'should make POST request to register AI assistant' , async ( ) => {
894
894
mockSuccessAPIRequest ( successResult )
@@ -1602,6 +1602,16 @@ describe('apiClient.automation', () => {
1602
1602
expect ( error . status ) . toBe ( 500 )
1603
1603
expect ( error . message ) . toBe ( 'Internal server error' )
1604
1604
} )
1605
+
1606
+ it ( 'stopFlowInstanceExecution fails with not found error' , async ( ) => {
1607
+ mockFailedAPIRequest ( 'Flow instance not found' , 404 )
1608
+
1609
+ const error = await automationAPI . stopFlowInstanceExecution ( appId , flowId , versionId , executionId ) . catch ( e => e )
1610
+
1611
+ expect ( error ) . toBeInstanceOf ( Error )
1612
+ expect ( error . status ) . toBe ( 404 )
1613
+ expect ( error . message ) . toBe ( 'Flow instance not found' )
1614
+ } )
1605
1615
} )
1606
1616
1607
1617
describe ( 'Debug Session Errors' , ( ) => {
@@ -1654,4 +1664,4 @@ describe('apiClient.automation', () => {
1654
1664
} )
1655
1665
} )
1656
1666
} )
1657
- } )
1667
+ } )
0 commit comments