1- import { afterEach , beforeEach , describe , expect , mock , test } from 'bun:test'
2- import { NextRequest } from 'next/server'
3-
41import { AnalyticsEvent } from '@codebuff/common/constants/analytics-events'
52import { TEST_USER_ID } from '@codebuff/common/old-constants'
3+ import { afterEach , beforeEach , describe , expect , mock , test } from 'bun:test'
4+ import { NextRequest } from 'next/server'
65
7- import { agentRunsPost } from '../agent-runs '
6+ import { postAgentRuns } from '../_post '
87
98import type { TrackEventFn } from '@codebuff/common/types/contracts/analytics'
109import type {
@@ -79,7 +78,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
7978 } ) ,
8079 } )
8180
82- const response = await agentRunsPost ( {
81+ const response = await postAgentRuns ( {
8382 req,
8483 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
8584 logger : mockLogger ,
@@ -102,7 +101,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
102101 } ) ,
103102 } )
104103
105- const response = await agentRunsPost ( {
104+ const response = await postAgentRuns ( {
106105 req,
107106 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
108107 logger : mockLogger ,
@@ -125,7 +124,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
125124 } ) ,
126125 } )
127126
128- const response = await agentRunsPost ( {
127+ const response = await postAgentRuns ( {
129128 req,
130129 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
131130 logger : mockLogger ,
@@ -147,7 +146,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
147146 } ) ,
148147 } )
149148
150- const response = await agentRunsPost ( {
149+ const response = await postAgentRuns ( {
151150 req,
152151 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
153152 logger : mockLogger ,
@@ -169,7 +168,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
169168 } ) ,
170169 } )
171170
172- const response = await agentRunsPost ( {
171+ const response = await postAgentRuns ( {
173172 req,
174173 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
175174 logger : mockLogger ,
@@ -191,7 +190,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
191190 body : 'not json' ,
192191 } )
193192
194- const response = await agentRunsPost ( {
193+ const response = await postAgentRuns ( {
195194 req,
196195 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
197196 logger : mockLogger ,
@@ -213,7 +212,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
213212 } ) ,
214213 } )
215214
216- const response = await agentRunsPost ( {
215+ const response = await postAgentRuns ( {
217216 req,
218217 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
219218 logger : mockLogger ,
@@ -236,7 +235,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
236235 } ) ,
237236 } )
238237
239- const response = await agentRunsPost ( {
238+ const response = await postAgentRuns ( {
240239 req,
241240 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
242241 logger : mockLogger ,
@@ -260,7 +259,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
260259 } ) ,
261260 } )
262261
263- const response = await agentRunsPost ( {
262+ const response = await postAgentRuns ( {
264263 req,
265264 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
266265 logger : mockLogger ,
@@ -283,7 +282,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
283282 } ) ,
284283 } )
285284
286- const response = await agentRunsPost ( {
285+ const response = await postAgentRuns ( {
287286 req,
288287 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
289288 logger : mockLogger ,
@@ -321,7 +320,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
321320 } ) ,
322321 } )
323322
324- const response = await agentRunsPost ( {
323+ const response = await postAgentRuns ( {
325324 req,
326325 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
327326 logger : mockLogger ,
@@ -355,7 +354,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
355354 } ) ,
356355 } )
357356
358- const response = await agentRunsPost ( {
357+ const response = await postAgentRuns ( {
359358 req,
360359 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
361360 logger : mockLogger ,
@@ -391,7 +390,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
391390 } ) ,
392391 } )
393392
394- const response = await agentRunsPost ( {
393+ const response = await postAgentRuns ( {
395394 req,
396395 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
397396 logger : mockLogger ,
@@ -428,7 +427,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
428427 } ) ,
429428 } )
430429
431- const response = await agentRunsPost ( {
430+ const response = await postAgentRuns ( {
432431 req,
433432 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
434433 logger : mockLogger ,
@@ -455,7 +454,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
455454 } ) ,
456455 } )
457456
458- const response = await agentRunsPost ( {
457+ const response = await postAgentRuns ( {
459458 req,
460459 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
461460 logger : mockLogger ,
@@ -482,7 +481,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
482481 } ) ,
483482 } )
484483
485- const response = await agentRunsPost ( {
484+ const response = await postAgentRuns ( {
486485 req,
487486 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
488487 logger : mockLogger ,
@@ -509,7 +508,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
509508 } ) ,
510509 } )
511510
512- const response = await agentRunsPost ( {
511+ const response = await postAgentRuns ( {
513512 req,
514513 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
515514 logger : mockLogger ,
@@ -536,7 +535,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
536535 } ) ,
537536 } )
538537
539- const response = await agentRunsPost ( {
538+ const response = await postAgentRuns ( {
540539 req,
541540 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
542541 logger : mockLogger ,
@@ -579,7 +578,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
579578 } ) ,
580579 } )
581580
582- const response = await agentRunsPost ( {
581+ const response = await postAgentRuns ( {
583582 req,
584583 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
585584 logger : mockLogger ,
@@ -620,7 +619,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
620619 } ) ,
621620 } )
622621
623- const response = await agentRunsPost ( {
622+ const response = await postAgentRuns ( {
624623 req,
625624 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
626625 logger : mockLogger ,
@@ -661,7 +660,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
661660 } ) ,
662661 } )
663662
664- const response = await agentRunsPost ( {
663+ const response = await postAgentRuns ( {
665664 req,
666665 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
667666 logger : mockLogger ,
@@ -695,7 +694,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
695694 } ) ,
696695 } )
697696
698- const response = await agentRunsPost ( {
697+ const response = await postAgentRuns ( {
699698 req,
700699 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
701700 logger : mockLogger ,
@@ -733,7 +732,7 @@ describe('/api/v1/agent-runs POST endpoint', () => {
733732 } ) ,
734733 } )
735734
736- const response = await agentRunsPost ( {
735+ const response = await postAgentRuns ( {
737736 req,
738737 getUserInfoFromApiKey : mockGetUserInfoFromApiKey ,
739738 logger : mockLogger ,
0 commit comments