Repository navigation
Commit 8bd0e36
test(router): pin a catch-all tail segment ending in
<!-- claude-projects-attribution: {"github_login":"dinwwwh"} -->
_Requested by **dinwwwh** · [project
thread](https://claude.ai/code/project/chan_01UcKMz91tMarPV1kWLVgLYE?thread=cmsg_01UcKMz91tMarPV1kWLVgLYE6swgSUM9SyULmBVdRjY2t7)_
## What
This is a test-only change. The literal-text test in `router.test.ts`
now adds `/f/{+p}/id}` and checks two requests:
- `/f/1/id}` matches it, with `{ p: '1' }`.
- `/f/1/id` matches nothing.
## Why
Since #186, the tree build calls `toSegment` only for parts that start
with `{`. A catch-all's tail segments still go through `toSegment`
whatever they start with, and so do `parse`'s callers
(`createPrefixMatcher` and the two-catch-all check in `add`). Mutation
testing found that dropping the leading-`{` half of `toSegment`'s param
check failed no test, even with the 73 tests now on main. With that
mutant, `id}` becomes a param named `d`, so `/f/1/id` matches. The new
assertions catch it.
## Checks
- All 73 router tests pass, and `pnpm check` passes.
- With that mutant applied, the test fails.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01VVaw7Sutbw6xMTMyDFeNfw)_
Co-authored-by: Claude <noreply@anthropic.com>} as literal (#193)1 parent 1e46b22 commit 8bd0e36
1 file changed
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
| |||
117 | 118 | | |
118 | 119 | | |
119 | 120 | | |
| 121 | + | |
| 122 | + | |
120 | 123 | | |
121 | 124 | | |
122 | 125 | | |
| |||
0 commit comments