@@ -2,12 +2,13 @@ import { TEST_AGENT_RUNTIME_IMPL } from '@codebuff/common/testing/impl/agent-run
22import { describe , test , expect , beforeEach } from 'bun:test'
33import { NextRequest } from 'next/server'
44
5- import { VALID_USER_INFO_FIELDS } from '../../../db/user'
6- import { meGet } from '../me'
5+ import { _meGet } from '../route'
76
87import type { AgentRuntimeDeps } from '@codebuff/common/types/contracts/agent-runtime'
98import type { GetUserInfoFromApiKeyOutput } from '@codebuff/common/types/contracts/database'
109
10+ import { VALID_USER_INFO_FIELDS } from '@/db/user'
11+
1112describe ( '/api/v1/me route' , ( ) => {
1213 const mockUserData : Record <
1314 string ,
@@ -48,7 +49,7 @@ describe('/api/v1/me route', () => {
4849 describe ( 'Authentication' , ( ) => {
4950 test ( 'returns 401 when Authorization header is missing' , async ( ) => {
5051 const req = new NextRequest ( 'http://localhost:3000/api/v1/me' )
51- const response = await meGet ( {
52+ const response = await _meGet ( {
5253 ...agentRuntimeImpl ,
5354 req,
5455 } )
@@ -62,7 +63,7 @@ describe('/api/v1/me route', () => {
6263 const req = new NextRequest ( 'http://localhost:3000/api/v1/me' , {
6364 headers : { Authorization : 'InvalidFormat' } ,
6465 } )
65- const response = await meGet ( {
66+ const response = await _meGet ( {
6667 ...agentRuntimeImpl ,
6768 req,
6869 } )
@@ -78,7 +79,7 @@ describe('/api/v1/me route', () => {
7879 headers : { 'x-codebuff-api-key' : apiKey } ,
7980 } )
8081
81- const response = await meGet ( {
82+ const response = await _meGet ( {
8283 ...agentRuntimeImpl ,
8384 req,
8485 } )
@@ -93,7 +94,7 @@ describe('/api/v1/me route', () => {
9394 headers : { Authorization : `Bearer ${ apiKey } ` } ,
9495 } )
9596
96- const response = await meGet ( {
97+ const response = await _meGet ( {
9798 ...agentRuntimeImpl ,
9899 req,
99100 } )
@@ -107,7 +108,7 @@ describe('/api/v1/me route', () => {
107108 headers : { Authorization : 'Bearer invalid-key' } ,
108109 } )
109110
110- const response = await meGet ( {
111+ const response = await _meGet ( {
111112 ...agentRuntimeImpl ,
112113 req,
113114 } )
@@ -123,7 +124,7 @@ describe('/api/v1/me route', () => {
123124 headers : { Authorization : 'Bearer test-api-key-123' } ,
124125 } )
125126
126- const response = await meGet ( {
127+ const response = await _meGet ( {
127128 ...agentRuntimeImpl ,
128129 req,
129130 } )
@@ -140,7 +141,7 @@ describe('/api/v1/me route', () => {
140141 } ,
141142 )
142143
143- const response = await meGet ( {
144+ const response = await _meGet ( {
144145 ...agentRuntimeImpl ,
145146 req,
146147 } )
@@ -157,7 +158,7 @@ describe('/api/v1/me route', () => {
157158 } ,
158159 )
159160
160- const response = await meGet ( {
161+ const response = await _meGet ( {
161162 ...agentRuntimeImpl ,
162163 req,
163164 } )
@@ -178,7 +179,7 @@ describe('/api/v1/me route', () => {
178179 } ,
179180 )
180181
181- const response = await meGet ( {
182+ const response = await _meGet ( {
182183 ...agentRuntimeImpl ,
183184 req,
184185 } )
@@ -199,7 +200,7 @@ describe('/api/v1/me route', () => {
199200 } ,
200201 )
201202
202- const response = await meGet ( {
203+ const response = await _meGet ( {
203204 ...agentRuntimeImpl ,
204205 req,
205206 } )
@@ -219,7 +220,7 @@ describe('/api/v1/me route', () => {
219220 } ,
220221 )
221222
222- const response = await meGet ( {
223+ const response = await _meGet ( {
223224 ...agentRuntimeImpl ,
224225 req,
225226 } )
@@ -236,7 +237,7 @@ describe('/api/v1/me route', () => {
236237 } ,
237238 )
238239
239- const response = await meGet ( {
240+ const response = await _meGet ( {
240241 ...agentRuntimeImpl ,
241242 req,
242243 } )
@@ -250,7 +251,7 @@ describe('/api/v1/me route', () => {
250251 headers : { Authorization : 'Bearer test-api-key-123' } ,
251252 } )
252253
253- const response = await meGet ( {
254+ const response = await _meGet ( {
254255 ...agentRuntimeImpl ,
255256 req,
256257 } )
@@ -267,7 +268,7 @@ describe('/api/v1/me route', () => {
267268 } ,
268269 )
269270
270- const response = await meGet ( {
271+ const response = await _meGet ( {
271272 ...agentRuntimeImpl ,
272273 req,
273274 } )
@@ -284,7 +285,7 @@ describe('/api/v1/me route', () => {
284285 } ,
285286 )
286287
287- const response = await meGet ( {
288+ const response = await _meGet ( {
288289 ...agentRuntimeImpl ,
289290 req,
290291 } )
@@ -305,7 +306,7 @@ describe('/api/v1/me route', () => {
305306 } ,
306307 )
307308
308- const response = await meGet ( {
309+ const response = await _meGet ( {
309310 ...agentRuntimeImpl ,
310311 req,
311312 } )
@@ -321,7 +322,7 @@ describe('/api/v1/me route', () => {
321322 headers : { Authorization : 'Bearer test-api-key-123' } ,
322323 } )
323324
324- const response = await meGet ( {
325+ const response = await _meGet ( {
325326 ...agentRuntimeImpl ,
326327 req,
327328 } )
@@ -338,7 +339,7 @@ describe('/api/v1/me route', () => {
338339 } ,
339340 )
340341
341- const response = await meGet ( {
342+ const response = await _meGet ( {
342343 ...agentRuntimeImpl ,
343344 req,
344345 } )
@@ -353,7 +354,7 @@ describe('/api/v1/me route', () => {
353354 } ,
354355 )
355356
356- const response = await meGet ( {
357+ const response = await _meGet ( {
357358 ...agentRuntimeImpl ,
358359 req,
359360 } )
0 commit comments