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:
Fredrik Adelöw
2026-05-21 15:49:36 +02:00
parent bc1b4263c9
commit fcde31d871
2 changed files with 29 additions and 50 deletions
@@ -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>
);
}