@@ -8,6 +8,7 @@ describe('<Automations> Basic', function() {
88
99 const FLOW_NAME = 'FlowName'
1010 const FLOW_ID = 'FlowID'
11+ const EXECUTION_ID = 'ExecutionID'
1112 const TRIGGER_NAME = 'TriggerName'
1213 const TRIGGER_ID = 'TriggerID'
1314
@@ -198,8 +199,11 @@ describe('<Automations> Basic', function() {
198199 it ( 'success' , async ( ) => {
199200 const req1 = prepareMockRequest ( )
200201 const req2 = prepareMockRequest ( )
202+ const req3 = prepareMockRequest ( )
203+
201204 await Backendless . Automations . activateFlowTriggerById ( FLOW_ID , TRIGGER_ID )
202205 await Backendless . Automations . activateFlowTriggerById ( FLOW_ID , TRIGGER_ID , { name : 'Nick' } )
206+ await Backendless . Automations . activateFlowTriggerById ( FLOW_ID , TRIGGER_ID , { name : 'Nick' } , EXECUTION_ID )
203207
204208 expect ( req1 ) . to . deep . include ( {
205209 method : 'POST' ,
@@ -215,6 +219,14 @@ describe('<Automations> Basic', function() {
215219 }
216220 } )
217221
222+ expect ( req3 ) . to . deep . include ( {
223+ method : 'POST' ,
224+ path : `${ APP_PATH } /automation/flow/${ FLOW_ID } /trigger/${ TRIGGER_ID } /activate?executionId=ExecutionID` ,
225+ body : {
226+ name : 'Nick' ,
227+ }
228+ } )
229+
218230 } )
219231
220232 it ( 'fails when flow id is invalid' , async ( ) => {
@@ -262,6 +274,19 @@ describe('<Automations> Basic', function() {
262274 await expect ( Backendless . Automations . activateFlowTriggerById ( FLOW_ID , TRIGGER_ID , [ ] ) ) . to . eventually . be . rejectedWith ( errorMsg )
263275 await expect ( Backendless . Automations . activateFlowTriggerById ( FLOW_ID , TRIGGER_ID , ( ) => ( { } ) ) ) . to . eventually . be . rejectedWith ( errorMsg )
264276 } )
277+
278+ it ( 'fails when execution id is invalid' , async ( ) => {
279+ const errorMsg = 'The "executionId" argument must be a non-empty string.'
280+
281+ await expect ( Backendless . Automations . activateFlowTriggerById ( FLOW_ID , TRIGGER_ID , { } , null ) ) . to . eventually . be . rejectedWith ( errorMsg )
282+ await expect ( Backendless . Automations . activateFlowTriggerById ( FLOW_ID , TRIGGER_ID , { } , true ) ) . to . eventually . be . rejectedWith ( errorMsg )
283+ await expect ( Backendless . Automations . activateFlowTriggerById ( FLOW_ID , TRIGGER_ID , { } , false ) ) . to . eventually . be . rejectedWith ( errorMsg )
284+ await expect ( Backendless . Automations . activateFlowTriggerById ( FLOW_ID , TRIGGER_ID , { } , 0 ) ) . to . eventually . be . rejectedWith ( errorMsg )
285+ await expect ( Backendless . Automations . activateFlowTriggerById ( FLOW_ID , TRIGGER_ID , { } , 123 ) ) . to . eventually . be . rejectedWith ( errorMsg )
286+ await expect ( Backendless . Automations . activateFlowTriggerById ( FLOW_ID , TRIGGER_ID , { } , [ ] ) ) . to . eventually . be . rejectedWith ( errorMsg )
287+ await expect ( Backendless . Automations . activateFlowTriggerById ( FLOW_ID , TRIGGER_ID , { } , ( ) => ( { } ) ) ) . to . eventually . be . rejectedWith ( errorMsg )
288+ await expect ( Backendless . Automations . activateFlowTriggerById ( FLOW_ID , TRIGGER_ID , { } , '' ) ) . to . eventually . be . rejectedWith ( errorMsg )
289+ } )
265290 } )
266291
267292} )
0 commit comments