Address review: remove fallback route, handle trailing splat, extract shared path
- Remove the path="*" fallback Route so mismatches between mountPath and initialRouteEntries surface as test failures instead of silently rendering without params - Handle mountPath values that already end with /* to avoid double splat - Extract repeated entity path string into a shared constant Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -157,11 +157,12 @@ export function renderInTestApp<const TApiPairs extends any[] = any[]>(
|
||||
|
||||
if (mountPath) {
|
||||
const routePath =
|
||||
mountPath === '/' ? mountPath : `${mountPath.replace(/\/$/, '')}/*`;
|
||||
mountPath === '/' || mountPath.endsWith('/*')
|
||||
? mountPath
|
||||
: `${mountPath.replace(/\/$/, '')}/*`;
|
||||
content = (
|
||||
<Routes>
|
||||
<Route path={routePath} element={content} />
|
||||
<Route path="*" element={content} />
|
||||
</Routes>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user