mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-09 12:57:46 +00:00
[remix] Support optional static path segments (#9607)
Fixes https://github.com/orgs/vercel/discussions/1707.
This commit is contained in:
@@ -104,6 +104,14 @@ describe('getPathFromRoute()', () => {
|
||||
parentId: 'root',
|
||||
file: 'routes/($lang)/$pid.tsx',
|
||||
},
|
||||
'routes/admin.(lol)': {
|
||||
path: 'admin/lol?',
|
||||
index: undefined,
|
||||
caseSensitive: undefined,
|
||||
id: 'routes/admin.(lol)',
|
||||
parentId: 'root',
|
||||
file: 'routes/admin.(lol).tsx',
|
||||
},
|
||||
};
|
||||
|
||||
it.each([
|
||||
@@ -156,6 +164,10 @@ describe('getPathFromRoute()', () => {
|
||||
id: 'routes/($lang)/$pid',
|
||||
expected: { path: '(:lang)/:pid', rePath: '/:lang?/:pid' },
|
||||
},
|
||||
{
|
||||
id: 'routes/admin.(lol)',
|
||||
expected: { path: 'admin/(lol)', rePath: '/admin/(lol)?' },
|
||||
},
|
||||
])('should return `$expected` for "$id" route', ({ id, expected }) => {
|
||||
const route = routes[id];
|
||||
expect(getPathFromRoute(route, routes)).toMatchObject(expected);
|
||||
|
||||
Reference in New Issue
Block a user