@@ -149,7 +149,7 @@ describe('GET /api/orders', () => {
149149 vi . mocked ( getServerSession ) . mockResolvedValue ( null ) ;
150150
151151 const request = new NextRequest ( 'http://localhost:3000/api/orders' ) ;
152- const response = await GET ( request ) ;
152+ const response = await GET ( request , { } as any ) ;
153153 const data = await response . json ( ) ;
154154
155155 expect ( response . status ) . toBe ( 401 ) ;
@@ -161,7 +161,7 @@ describe('GET /api/orders', () => {
161161 vi . mocked ( getServerSession ) . mockResolvedValue ( { user : null } as any ) ;
162162
163163 const request = new NextRequest ( 'http://localhost:3000/api/orders' ) ;
164- const response = await GET ( request ) ;
164+ const response = await GET ( request , { } as any ) ;
165165 const data = await response . json ( ) ;
166166
167167 expect ( response . status ) . toBe ( 401 ) ;
@@ -179,7 +179,7 @@ describe('GET /api/orders', () => {
179179 } as any ) ;
180180
181181 const request = new NextRequest ( 'http://localhost:3000/api/orders' ) ;
182- const response = await GET ( request ) ;
182+ const response = await GET ( request , { } as any ) ;
183183 const data = await response . json ( ) ;
184184
185185 expect ( response . status ) . toBe ( 403 ) ;
@@ -197,7 +197,7 @@ describe('GET /api/orders', () => {
197197 } as any ) ;
198198
199199 const request = new NextRequest ( 'http://localhost:3000/api/orders' ) ;
200- const response = await GET ( request ) ;
200+ const response = await GET ( request , { } as any ) ;
201201 const data = await response . json ( ) ;
202202
203203 expect ( response . status ) . toBe ( 403 ) ;
@@ -220,7 +220,7 @@ describe('GET /api/orders', () => {
220220 } ) ;
221221
222222 const request = new NextRequest ( 'http://localhost:3000/api/orders' ) ;
223- const response = await GET ( request ) ;
223+ const response = await GET ( request , { } as any ) ;
224224 const data = await response . json ( ) ;
225225
226226 expect ( response . status ) . toBe ( 200 ) ;
@@ -235,7 +235,7 @@ describe('GET /api/orders', () => {
235235 } ) ;
236236
237237 const request = new NextRequest ( 'http://localhost:3000/api/orders' ) ;
238- const response = await GET ( request ) ;
238+ const response = await GET ( request , { } as any ) ;
239239 const data = await response . json ( ) ;
240240
241241 expect ( response . status ) . toBe ( 200 ) ;
@@ -256,7 +256,7 @@ describe('GET /api/orders', () => {
256256 } ) ;
257257
258258 const request = new NextRequest ( 'http://localhost:3000/api/orders' ) ;
259- const response = await GET ( request ) ;
259+ const response = await GET ( request , { } as any ) ;
260260 const data = await response . json ( ) ;
261261
262262 expect ( response . status ) . toBe ( 200 ) ;
@@ -275,7 +275,7 @@ describe('GET /api/orders', () => {
275275
276276 it ( 'should use default pagination if not specified' , async ( ) => {
277277 const request = new NextRequest ( 'http://localhost:3000/api/orders' ) ;
278- await GET ( request ) ;
278+ await GET ( request , { } as any ) ;
279279
280280 expect ( orderService . listOrders ) . toHaveBeenCalledWith (
281281 expect . objectContaining ( {
@@ -286,10 +286,8 @@ describe('GET /api/orders', () => {
286286 } ) ;
287287
288288 it ( 'should accept custom pagination parameters' , async ( ) => {
289- const request = new NextRequest (
290- 'http://localhost:3000/api/orders?page=2&perPage=50'
291- ) ;
292- await GET ( request ) ;
289+ const request = new NextRequest ( 'http://localhost:3000/api/orders?page=2&perPage=50' , { } ) ;
290+ await GET ( request , { } as any ) ;
293291
294292 expect ( orderService . listOrders ) . toHaveBeenCalledWith (
295293 expect . objectContaining ( {
@@ -300,10 +298,8 @@ describe('GET /api/orders', () => {
300298 } ) ;
301299
302300 it ( 'should enforce max perPage limit of 100' , async ( ) => {
303- const request = new NextRequest (
304- 'http://localhost:3000/api/orders?perPage=150'
305- ) ;
306- const response = await GET ( request ) ;
301+ const request = new NextRequest ( 'http://localhost:3000/api/orders?perPage=150' , { } ) ;
302+ const response = await GET ( request , { } as any ) ;
307303 const data = await response . json ( ) ;
308304
309305 expect ( response . status ) . toBe ( 400 ) ;
@@ -315,7 +311,7 @@ describe('GET /api/orders', () => {
315311 const request = new NextRequest (
316312 `http://localhost:3000/api/orders?status=${ OrderStatus . PENDING } `
317313 ) ;
318- await GET ( request ) ;
314+ await GET ( request , { } as any ) ;
319315
320316 expect ( orderService . listOrders ) . toHaveBeenCalledWith (
321317 expect . objectContaining ( {
@@ -325,10 +321,8 @@ describe('GET /api/orders', () => {
325321 } ) ;
326322
327323 it ( 'should accept search query' , async ( ) => {
328- const request = new NextRequest (
329- 'http://localhost:3000/api/orders?search=ORD-001'
330- ) ;
331- await GET ( request ) ;
324+ const request = new NextRequest ( 'http://localhost:3000/api/orders?search=ORD-001' , { } ) ;
325+ await GET ( request , { } as any ) ;
332326
333327 expect ( orderService . listOrders ) . toHaveBeenCalledWith (
334328 expect . objectContaining ( {
@@ -343,7 +337,7 @@ describe('GET /api/orders', () => {
343337 const request = new NextRequest (
344338 `http://localhost:3000/api/orders?dateFrom=${ dateFrom } &dateTo=${ dateTo } `
345339 ) ;
346- await GET ( request ) ;
340+ await GET ( request , { } as any ) ;
347341
348342 expect ( orderService . listOrders ) . toHaveBeenCalledWith (
349343 expect . objectContaining ( {
@@ -354,10 +348,8 @@ describe('GET /api/orders', () => {
354348 } ) ;
355349
356350 it ( 'should accept custom sorting' , async ( ) => {
357- const request = new NextRequest (
358- 'http://localhost:3000/api/orders?sortBy=totalAmount&sortOrder=asc'
359- ) ;
360- await GET ( request ) ;
351+ const request = new NextRequest ( 'http://localhost:3000/api/orders?sortBy=totalAmount&sortOrder=asc' , { } ) ;
352+ await GET ( request , { } as any ) ;
361353
362354 expect ( orderService . listOrders ) . toHaveBeenCalledWith (
363355 expect . objectContaining ( {
@@ -369,7 +361,7 @@ describe('GET /api/orders', () => {
369361
370362 it ( 'should use default sorting if not specified' , async ( ) => {
371363 const request = new NextRequest ( 'http://localhost:3000/api/orders' ) ;
372- await GET ( request ) ;
364+ await GET ( request , { } as any ) ;
373365
374366 expect ( orderService . listOrders ) . toHaveBeenCalledWith (
375367 expect . objectContaining ( {
@@ -380,10 +372,8 @@ describe('GET /api/orders', () => {
380372 } ) ;
381373
382374 it ( 'should return 400 for invalid sortBy value' , async ( ) => {
383- const request = new NextRequest (
384- 'http://localhost:3000/api/orders?sortBy=invalidField'
385- ) ;
386- const response = await GET ( request ) ;
375+ const request = new NextRequest ( 'http://localhost:3000/api/orders?sortBy=invalidField' , { } ) ;
376+ const response = await GET ( request , { } as any ) ;
387377 const data = await response . json ( ) ;
388378
389379 expect ( response . status ) . toBe ( 400 ) ;
@@ -401,10 +391,8 @@ describe('GET /api/orders', () => {
401391 const mockCSV = 'Order Number,Customer Name,Total\nORD-001,John Doe,100.00' ;
402392 vi . mocked ( orderService . exportOrdersToCSV ) . mockResolvedValue ( mockCSV ) ;
403393
404- const request = new NextRequest (
405- 'http://localhost:3000/api/orders?export=csv'
406- ) ;
407- const response = await GET ( request ) ;
394+ const request = new NextRequest ( 'http://localhost:3000/api/orders?export=csv' , { } ) ;
395+ const response = await GET ( request , { } as any ) ;
408396 const csvData = await response . text ( ) ;
409397
410398 expect ( response . status ) . toBe ( 200 ) ;
@@ -423,7 +411,7 @@ describe('GET /api/orders', () => {
423411 const request = new NextRequest (
424412 `http://localhost:3000/api/orders?export=csv&status=${ OrderStatus . PENDING } &search=ORD`
425413 ) ;
426- await GET ( request ) ;
414+ await GET ( request , { } as any ) ;
427415
428416 expect ( orderService . exportOrdersToCSV ) . toHaveBeenCalledWith (
429417 expect . objectContaining ( {
@@ -437,10 +425,8 @@ describe('GET /api/orders', () => {
437425 const mockCSV = 'Order Number,Customer Name,Total\nORD-001,John Doe,100.00' ;
438426 vi . mocked ( orderService . exportOrdersToCSV ) . mockResolvedValue ( mockCSV ) ;
439427
440- const request = new NextRequest (
441- 'http://localhost:3000/api/orders?export=csv'
442- ) ;
443- await GET ( request ) ;
428+ const request = new NextRequest ( 'http://localhost:3000/api/orders?export=csv' , { } ) ;
429+ await GET ( request , { } as any ) ;
444430
445431 expect ( orderService . exportOrdersToCSV ) . toHaveBeenCalled ( ) ;
446432 expect ( orderService . listOrders ) . not . toHaveBeenCalled ( ) ;
@@ -458,7 +444,7 @@ describe('GET /api/orders', () => {
458444
459445 it ( 'should return orders with success response' , async ( ) => {
460446 const request = new NextRequest ( 'http://localhost:3000/api/orders' ) ;
461- const response = await GET ( request ) ;
447+ const response = await GET ( request , { } as any ) ;
462448 const data = await response . json ( ) ;
463449
464450 expect ( response . status ) . toBe ( 200 ) ;
@@ -485,7 +471,7 @@ describe('GET /api/orders', () => {
485471 } ) ;
486472
487473 const request = new NextRequest ( 'http://localhost:3000/api/orders' ) ;
488- const response = await GET ( request ) ;
474+ const response = await GET ( request , { } as any ) ;
489475 const data = await response . json ( ) ;
490476
491477 expect ( response . status ) . toBe ( 200 ) ;
@@ -505,7 +491,7 @@ describe('GET /api/orders', () => {
505491 const request = new NextRequest (
506492 'http://localhost:3000/api/orders?page=0' // Invalid: page must be positive
507493 ) ;
508- const response = await GET ( request ) ;
494+ const response = await GET ( request , { } as any ) ;
509495 const data = await response . json ( ) ;
510496
511497 expect ( response . status ) . toBe ( 400 ) ;
@@ -520,7 +506,7 @@ describe('GET /api/orders', () => {
520506 ) ;
521507
522508 const request = new NextRequest ( 'http://localhost:3000/api/orders' ) ;
523- const response = await GET ( request ) ;
509+ const response = await GET ( request , { } as any ) ;
524510 const data = await response . json ( ) ;
525511
526512 expect ( response . status ) . toBe ( 500 ) ;
@@ -532,7 +518,7 @@ describe('GET /api/orders', () => {
532518 vi . mocked ( orderService . listOrders ) . mockRejectedValue ( 'Unknown error' ) ;
533519
534520 const request = new NextRequest ( 'http://localhost:3000/api/orders' ) ;
535- const response = await GET ( request ) ;
521+ const response = await GET ( request , { } as any ) ;
536522 const data = await response . json ( ) ;
537523
538524 expect ( response . status ) . toBe ( 500 ) ;
@@ -550,7 +536,7 @@ describe('GET /api/orders', () => {
550536 } ) ;
551537
552538 const request = new NextRequest ( 'http://localhost:3000/api/orders' ) ;
553- await GET ( request ) ;
539+ await GET ( request , { } as any ) ;
554540
555541 expect ( orderService . listOrders ) . toHaveBeenCalledWith (
556542 expect . objectContaining ( {
@@ -574,7 +560,7 @@ describe('GET /api/orders', () => {
574560 } ) ;
575561
576562 const request = new NextRequest ( 'http://localhost:3000/api/orders' ) ;
577- await GET ( request ) ;
563+ await GET ( request , { } as any ) ;
578564
579565 expect ( orderService . listOrders ) . toHaveBeenCalledWith (
580566 expect . objectContaining ( {
0 commit comments