File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import fs from 'node:fs'
2+ import { describe , expect , it } from 'vitest'
3+
4+ type VercelConfig = {
5+ rewrites ?: Array < { source : string ; destination : string } >
6+ }
7+
8+ describe ( 'Vercel routing' , ( ) => {
9+ it ( 'normalizes doubled /developers RSC routes at the edge' , ( ) => {
10+ const config = JSON . parse ( fs . readFileSync ( 'vercel.json' , 'utf8' ) ) as VercelConfig
11+ const rewrites = config . rewrites ?? [ ]
12+
13+ expect ( rewrites . slice ( 0 , 4 ) ) . toEqual ( [
14+ {
15+ source : '/developers/RSC/R/developers.txt' ,
16+ destination : '/developers/RSC/R/_root.txt' ,
17+ } ,
18+ {
19+ source : '/developers/RSC/R/developers/:path(.*)' ,
20+ destination : '/developers/RSC/R/:path' ,
21+ } ,
22+ {
23+ source : '/RSC/R/developers.txt' ,
24+ destination : '/RSC/R/_root.txt' ,
25+ } ,
26+ {
27+ source : '/RSC/R/developers/:path(.*)' ,
28+ destination : '/RSC/R/:path' ,
29+ } ,
30+ ] )
31+ } )
32+ } )
Original file line number Diff line number Diff line change 286286 }
287287 ],
288288 "rewrites" : [
289+ {
290+ "source" : " /developers/RSC/R/developers.txt" ,
291+ "destination" : " /developers/RSC/R/_root.txt"
292+ },
293+ {
294+ "source" : " /developers/RSC/R/developers/:path(.*)" ,
295+ "destination" : " /developers/RSC/R/:path"
296+ },
297+ {
298+ "source" : " /RSC/R/developers.txt" ,
299+ "destination" : " /RSC/R/_root.txt"
300+ },
301+ {
302+ "source" : " /RSC/R/developers/:path(.*)" ,
303+ "destination" : " /RSC/R/:path"
304+ },
289305 {
290306 "source" : " /ingest/static/:path(.*)" ,
291307 "destination" : " https://us-assets.i.posthog.com/static/:path"
You can’t perform that action at this time.
0 commit comments