@@ -102,6 +102,7 @@ describe('Webhook Trigger API Route', () => {
102102 globalMockData . webhooks . length = 0
103103 globalMockData . workflows . length = 0
104104 globalMockData . schedules . length = 0
105+ globalMockData . apiKeys . length = 0
105106
106107 mockExecutionDependencies ( )
107108 mockTriggerDevSdk ( )
@@ -222,7 +223,9 @@ describe('Webhook Trigger API Route', () => {
222223 globalMockData . workflows . push ( {
223224 id : 'test-workflow-id' ,
224225 userId : 'test-user-id' ,
226+ pinnedApiKeyId : 'test-pinned-api-key-id' ,
225227 } )
228+ globalMockData . apiKeys . push ( { id : 'test-pinned-api-key-id' , userId : 'test-user-id' } )
226229
227230 const req = createMockRequest ( 'POST' , { event : 'test' , id : 'test-123' } )
228231 const params = Promise . resolve ( { path : 'test-path' } )
@@ -250,7 +253,12 @@ describe('Webhook Trigger API Route', () => {
250253 providerConfig : { requireAuth : true , token : 'test-token-123' } ,
251254 workflowId : 'test-workflow-id' ,
252255 } )
253- globalMockData . workflows . push ( { id : 'test-workflow-id' , userId : 'test-user-id' } )
256+ globalMockData . workflows . push ( {
257+ id : 'test-workflow-id' ,
258+ userId : 'test-user-id' ,
259+ pinnedApiKeyId : 'test-pinned-api-key-id' ,
260+ } )
261+ globalMockData . apiKeys . push ( { id : 'test-pinned-api-key-id' , userId : 'test-user-id' } )
254262
255263 const headers = {
256264 'Content-Type' : 'application/json' ,
@@ -281,7 +289,12 @@ describe('Webhook Trigger API Route', () => {
281289 } ,
282290 workflowId : 'test-workflow-id' ,
283291 } )
284- globalMockData . workflows . push ( { id : 'test-workflow-id' , userId : 'test-user-id' } )
292+ globalMockData . workflows . push ( {
293+ id : 'test-workflow-id' ,
294+ userId : 'test-user-id' ,
295+ pinnedApiKeyId : 'test-pinned-api-key-id' ,
296+ } )
297+ globalMockData . apiKeys . push ( { id : 'test-pinned-api-key-id' , userId : 'test-user-id' } )
285298
286299 const headers = {
287300 'Content-Type' : 'application/json' ,
@@ -308,7 +321,11 @@ describe('Webhook Trigger API Route', () => {
308321 providerConfig : { requireAuth : true , token : 'case-test-token' } ,
309322 workflowId : 'test-workflow-id' ,
310323 } )
311- globalMockData . workflows . push ( { id : 'test-workflow-id' , userId : 'test-user-id' } )
324+ globalMockData . workflows . push ( {
325+ id : 'test-workflow-id' ,
326+ userId : 'test-user-id' ,
327+ pinnedApiKeyId : 'test-pinned-api-key-id' ,
328+ } )
312329
313330 vi . doMock ( '@trigger.dev/sdk' , ( ) => ( {
314331 tasks : {
@@ -354,7 +371,11 @@ describe('Webhook Trigger API Route', () => {
354371 } ,
355372 workflowId : 'test-workflow-id' ,
356373 } )
357- globalMockData . workflows . push ( { id : 'test-workflow-id' , userId : 'test-user-id' } )
374+ globalMockData . workflows . push ( {
375+ id : 'test-workflow-id' ,
376+ userId : 'test-user-id' ,
377+ pinnedApiKeyId : 'test-pinned-api-key-id' ,
378+ } )
358379
359380 vi . doMock ( '@trigger.dev/sdk' , ( ) => ( {
360381 tasks : {
@@ -391,7 +412,11 @@ describe('Webhook Trigger API Route', () => {
391412 providerConfig : { requireAuth : true , token : 'correct-token' } ,
392413 workflowId : 'test-workflow-id' ,
393414 } )
394- globalMockData . workflows . push ( { id : 'test-workflow-id' , userId : 'test-user-id' } )
415+ globalMockData . workflows . push ( {
416+ id : 'test-workflow-id' ,
417+ userId : 'test-user-id' ,
418+ pinnedApiKeyId : 'test-pinned-api-key-id' ,
419+ } )
395420
396421 const headers = {
397422 'Content-Type' : 'application/json' ,
@@ -424,7 +449,11 @@ describe('Webhook Trigger API Route', () => {
424449 } ,
425450 workflowId : 'test-workflow-id' ,
426451 } )
427- globalMockData . workflows . push ( { id : 'test-workflow-id' , userId : 'test-user-id' } )
452+ globalMockData . workflows . push ( {
453+ id : 'test-workflow-id' ,
454+ userId : 'test-user-id' ,
455+ pinnedApiKeyId : 'test-pinned-api-key-id' ,
456+ } )
428457
429458 const headers = {
430459 'Content-Type' : 'application/json' ,
@@ -453,7 +482,11 @@ describe('Webhook Trigger API Route', () => {
453482 providerConfig : { requireAuth : true , token : 'required-token' } ,
454483 workflowId : 'test-workflow-id' ,
455484 } )
456- globalMockData . workflows . push ( { id : 'test-workflow-id' , userId : 'test-user-id' } )
485+ globalMockData . workflows . push ( {
486+ id : 'test-workflow-id' ,
487+ userId : 'test-user-id' ,
488+ pinnedApiKeyId : 'test-pinned-api-key-id' ,
489+ } )
457490
458491 const req = createMockRequest ( 'POST' , { event : 'no.auth.test' } )
459492 const params = Promise . resolve ( { path : 'test-path' } )
@@ -482,7 +515,11 @@ describe('Webhook Trigger API Route', () => {
482515 } ,
483516 workflowId : 'test-workflow-id' ,
484517 } )
485- globalMockData . workflows . push ( { id : 'test-workflow-id' , userId : 'test-user-id' } )
518+ globalMockData . workflows . push ( {
519+ id : 'test-workflow-id' ,
520+ userId : 'test-user-id' ,
521+ pinnedApiKeyId : 'test-pinned-api-key-id' ,
522+ } )
486523
487524 const headers = {
488525 'Content-Type' : 'application/json' ,
@@ -515,7 +552,11 @@ describe('Webhook Trigger API Route', () => {
515552 } ,
516553 workflowId : 'test-workflow-id' ,
517554 } )
518- globalMockData . workflows . push ( { id : 'test-workflow-id' , userId : 'test-user-id' } )
555+ globalMockData . workflows . push ( {
556+ id : 'test-workflow-id' ,
557+ userId : 'test-user-id' ,
558+ pinnedApiKeyId : 'test-pinned-api-key-id' ,
559+ } )
519560
520561 const headers = {
521562 'Content-Type' : 'application/json' ,
0 commit comments