@@ -68,6 +68,7 @@ jest.mock(
68
68
jest . mock (
69
69
'routes-manifest.json' ,
70
70
( ) => ( {
71
+ basePath : '' ,
71
72
dynamicRoutes : [
72
73
{
73
74
page : '/posts/[title]' ,
@@ -88,6 +89,12 @@ jest.mock(
88
89
} ,
89
90
] ,
90
91
staticRoutes : [
92
+ {
93
+ namedRegex : '^/(?:/)?$' ,
94
+ page : '/' ,
95
+ regex : '^/(?:/)?$' ,
96
+ routeKeys : { } ,
97
+ } ,
91
98
{
92
99
page : '/non-i18n/with-revalidate' ,
93
100
regex : '^/non-i18n/with-revalidate(?:/)?$' ,
@@ -101,11 +108,23 @@ jest.mock(
101
108
namedRegex : '^/i18n/with-revalidate(?:/)?$' ,
102
109
} ,
103
110
] ,
111
+ redirects : [
112
+ {
113
+ basePath : false ,
114
+ destination : '/docs/' ,
115
+ internal : true ,
116
+ locale : false ,
117
+ regex : '^/docs$' ,
118
+ source : '/docs' ,
119
+ statusCode : 308 ,
120
+ } ,
121
+ ] ,
104
122
} ) ,
105
123
{ virtual : true } ,
106
124
)
107
125
108
126
const appPathsManifest = {
127
+ '/(group)/page' : 'app/(group)/page.js' ,
109
128
'/blog/(test)/[author]/[slug]/page' : 'app/blog/[author]/[slug]/page.js' ,
110
129
}
111
130
@@ -312,4 +331,19 @@ describe('the netlify next server', () => {
312
331
// eslint-disable-next-line no-underscore-dangle
313
332
expect ( process . env . __NEXT_PRIVATE_PREBUNDLED_REACT ) . toBe ( 'experimental' )
314
333
} )
334
+
335
+ it ( 'assigns correct prebundled react with basePath config using appdir' , async ( ) => {
336
+ const netlifyNextServer = new NetlifyNextServer ( { conf : { experimental : { appDir : true } , basePath : '/docs' } } , { } )
337
+ const requestHandler = netlifyNextServer . getRequestHandler ( )
338
+
339
+ const { req : mockReq , res : mockRes } = createRequestResponseMocks ( {
340
+ url : '/docs' ,
341
+ } )
342
+
343
+ // @ts -expect-error - Types are incorrect for `MockedResponse`
344
+ await requestHandler ( new NodeNextRequest ( mockReq ) , new NodeNextResponse ( mockRes ) )
345
+
346
+ // eslint-disable-next-line no-underscore-dangle
347
+ expect ( process . env . __NEXT_PRIVATE_PREBUNDLED_REACT ) . toBe ( 'next' )
348
+ } )
315
349
} )
0 commit comments