@@ -219,6 +219,55 @@ describe('useRunWorkflow({ router })', () => {
219
219
type : 'error' ,
220
220
} ) ;
221
221
} ) ;
222
+ it ( 'should execute workflow has pin data and is active with single webhook trigger' , async ( ) => {
223
+ const pinia = createTestingPinia ( { stubActions : false } ) ;
224
+ setActivePinia ( pinia ) ;
225
+ const toast = useToast ( ) ;
226
+ const i18n = useI18n ( ) ;
227
+ const { runWorkflow } = useRunWorkflow ( { router } ) ;
228
+
229
+ vi . mocked ( workflowsStore ) . isWorkflowActive = true ;
230
+
231
+ vi . mocked ( useWorkflowHelpers ( { router } ) ) . getWorkflowDataToSave . mockResolvedValue ( {
232
+ nodes : [
233
+ {
234
+ name : 'Slack' ,
235
+ type : 'n8n-nodes-base.slackTrigger' ,
236
+ disabled : false ,
237
+ } ,
238
+ ] ,
239
+ pinData : {
240
+ Slack : [ { json : { value : 'data2' } } ] ,
241
+ } ,
242
+ } as unknown as IWorkflowData ) ;
243
+
244
+ const mockExecutionResponse = { executionId : '123' } ;
245
+
246
+ vi . mocked ( uiStore ) . activeActions = [ '' ] ;
247
+ vi . mocked ( workflowHelpers ) . getCurrentWorkflow . mockReturnValue ( {
248
+ name : 'Test Workflow' ,
249
+ } as unknown as Workflow ) ;
250
+ vi . mocked ( workflowsStore ) . runWorkflow . mockResolvedValue ( mockExecutionResponse ) ;
251
+ vi . mocked ( workflowsStore ) . nodesIssuesExist = true ;
252
+ vi . mocked ( workflowHelpers ) . getWorkflowDataToSave . mockResolvedValue ( {
253
+ id : 'workflowId' ,
254
+ nodes : [ ] ,
255
+ } as unknown as IWorkflowData ) ;
256
+ vi . mocked ( workflowsStore ) . getWorkflowRunData = {
257
+ NodeName : [ ] ,
258
+ } ;
259
+
260
+ const result = await runWorkflow ( { } ) ;
261
+ expect ( result ) . toEqual ( mockExecutionResponse ) ;
262
+
263
+ expect ( toast . showMessage ) . not . toHaveBeenCalledWith ( {
264
+ title : i18n . baseText ( 'workflowRun.showError.deactivate' ) ,
265
+ message : i18n . baseText ( 'workflowRun.showError.productionActive' , {
266
+ interpolate : { nodeName : 'Webhook' } ,
267
+ } ) ,
268
+ type : 'error' ,
269
+ } ) ;
270
+ } ) ;
222
271
} ) ;
223
272
224
273
describe ( 'runWorkflow()' , ( ) => {
0 commit comments