1- import type { NextRequest , NextResponse as NextResponseType } from 'next/server' ;
21import {
32 isFeedDetailPage ,
4- isAuthenticatedNotGuest ,
53 rewriteFeedRequest ,
64 hasLocaleInPathname ,
75 rewriteWithDefaultLocale ,
86 DEFAULT_LOCALE ,
97 AUTHED_PROXY_HEADER ,
108 STATIC_PROXY_HEADER ,
119} from './proxy-helpers' ;
12- import * as sessionJwt from './session-jwt' ;
1310
1411// Mock the session-jwt module
1512jest . mock ( './session-jwt' ) ;
1613
1714// Helper to create mock NextRequest
18- function createMockNextRequest ( overrides : Partial < any > = { } ) : any {
15+ /* eslint-disable @typescript-eslint/consistent-type-assertions */
16+ function createMockNextRequest (
17+ overrides : Record < string , unknown > = { } ,
18+ ) : Record < string , unknown > {
1919 return {
2020 nextUrl : {
21- clone : jest . fn ( function ( this : any ) {
21+ clone : jest . fn ( function ( this : Record < string , unknown > ) {
2222 const url = new URL ( 'http://localhost' ) ;
2323 url . pathname = '/original' ;
2424 return url ;
2525 } ) ,
26- } as any ,
26+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
27+ } as Record < string , unknown > ,
2728 headers : new Headers ( ) ,
2829 cookies : {
2930 get : jest . fn ( ) ,
30- } as any ,
31+ } as Record < string , unknown > ,
3132 ...overrides ,
3233 } ;
3334}
35+ /* eslint-enable @typescript-eslint/consistent-type-assertions */
3436
3537// Mock routing module
3638jest . mock ( '../../i18n/routing' , ( ) => ( {
@@ -41,14 +43,17 @@ jest.mock('../../i18n/routing', () => ({
4143} ) ) ;
4244
4345// Spy on NextResponse.rewrite
46+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
4447let rewriteSpy : jest . SpyInstance ;
48+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
4549let NextResponse : any ;
4650
4751describe ( 'proxy-helpers' , ( ) => {
4852 beforeAll ( async ( ) => {
4953 // Dynamically import NextResponse to avoid module loading issues
5054 const nextServer = await import ( 'next/server' ) ;
51- NextResponse = nextServer . NextResponse ;
55+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
56+ NextResponse = nextServer . NextResponse as any ;
5257 rewriteSpy = jest . spyOn ( NextResponse , 'rewrite' ) ;
5358 } ) ;
5459
@@ -135,6 +140,7 @@ describe('proxy-helpers', () => {
135140 // ============================================================================
136141
137142 describe ( 'rewriteFeedRequest' , ( ) => {
143+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
138144 let mockRequest : any ;
139145
140146 beforeEach ( ( ) => {
@@ -278,7 +284,9 @@ describe('proxy-helpers', () => {
278284 it ( 'should handle paths with multiple segments' , ( ) => {
279285 mockUrl = new URL ( 'http://localhost/feeds/gbfs/test-456/map/details' ) ;
280286 rewriteWithDefaultLocale ( mockUrl ) ;
281- expect ( mockUrl . pathname ) . toBe ( `/${ DEFAULT_LOCALE } /feeds/gbfs/test-456/map/details` ) ;
287+ expect ( mockUrl . pathname ) . toBe (
288+ `/${ DEFAULT_LOCALE } /feeds/gbfs/test-456/map/details` ,
289+ ) ;
282290 } ) ;
283291
284292 it ( 'should return NextResponse' , ( ) => {
0 commit comments