Tests / @ogygia/router
@ogygia/router
Version 0.13.1
4b18f465 50 test runs (50 tests, each run in Node, the browsers or both)
0.51× lines of test for each line of source (1,110 to 2,160) Only real test code counts: test files and their helpers, not fixtures, sample apps or benches.
Blank lines are left out on both sides.
Exactly what is counted
non-blank lines of test code across the repo (*.test.ts, *.test-d.ts, *.spec.ts, and the .ts helpers in test/ and e2e/ folders; no fixtures, fixture apps, stubs or benches), over non-blank lines of packages/*/src (no .d.ts or generated files)70.4% of source lines run by the tests
- 50Unit
- 0Browser
- 0End to end
- 0Type tests
- 0Lint rules
- 0Failing
Coverage
- 70.4%Lines
- 52.5%Branches
- 69.3%Functions
- 67.7%Statements
Every test
End-to-end suites are not part of this report yet.
50 tests
| Test | Kind | Node | Chromium | Firefox | WebKit |
|---|---|---|---|---|---|
packages/router/test/route-config-router.test.ts | |||||
| route config × programmatic router > a `base` is stripped before matching; a path outside it is not this table’s | Unit | pass | not run | not run | not run |
| route config × programmatic router > a claimed-but-unset path shadows the file world; an unclaimed one falls through to it | Unit | pass | not run | not run | not run |
| route config × programmatic router > a page that sets nothing and an unmatched path both answer undefined (the default applies) | Unit | pass | not run | not run | not run |
| route config × programmatic router > dynamic patterns match like dispatch | Unit | pass | not run | not run | not run |
| route config × programmatic router > endpoints are not pages: claimed, nothing set, whatever the table says | Unit | pass | not run | not run | not run |
| route config × programmatic router > nested layouts: the innermost wins over an outer one | Unit | pass | not run | not run | not run |
| route config × programmatic router > page > layout > table — the deepest level wins | Unit | pass | not run | not run | not run |
| route config × programmatic router > re-registering the same table REPLACES its matcher (dev re-evaluation), never shadows it | Unit | pass | not run | not run | not run |
| route config × programmatic router > the merge is per key: a deeper config without the key keeps the outer value | Unit | pass | not run | not run | not run |
| route config × programmatic router > two mounted tables: the one that claims the path answers | Unit | pass | not run | not run | not run |
packages/router/test/router-api-client.test.ts | |||||
| api() — the typed endpoint client > a 200 whose JSON body does not parse rejects, it does not resolve undefined | Unit | pass | not run | not run | not run |
| api() — the typed endpoint client > a null return answers 204 → resolves undefined | Unit | pass | not run | not run | not run |
| api() — the typed endpoint client > a schema 400 throws ApiError carrying the issues body | Unit | pass | not run | not run | not run |
| api() — the typed endpoint client > an unmatched path throws ApiError 404 | Unit | pass | not run | not run | not run |
| api() — the typed endpoint client > fills the pattern, carries the query, parses the typed payload | Unit | pass | not run | not run | not run |
| api() — the typed endpoint client > POSTs the schema-typed body; the payload comes back typed | Unit | pass | not run | not run | not run |
packages/router/test/router-dispatch.test.ts | |||||
| dispatch — base, slash, miss > 308-canonicalizes a trailing slash under slash:never | Unit | pass | not run | not run | not run |
| dispatch — base, slash, miss > runs miss for an unmatched path under base | Unit | pass | not run | not run | not run |
| dispatch — base, slash, miss > strips base, returns null for out-of-base | Unit | pass | not run | not run | not run |
| dispatch — c.setHeaders reaches router-built responses > applies collected headers to the built response | Unit | pass | not run | not run | not run |
| dispatch — c.setHeaders reaches router-built responses > never clobbers headers the handler set explicitly | Unit | pass | not run | not run | not run |
| dispatch — endpoints, params, verbs > dispatches verbs, 405s the rest with allow, answers OPTIONS | Unit | pass | not run | not run | not run |
| dispatch — endpoints, params, verbs > falls through (null) on no match when unbased | Unit | pass | not run | not run | not run |
| dispatch — endpoints, params, verbs > routes GET endpoints with params ([slug], [...rest]) | Unit | pass | not run | not run | not run |
| dispatch — thrown redirect / error > error() from an endpoint → JSON error | Unit | pass | not run | not run | not run |
| dispatch — thrown redirect / error > redirect() → a redirect response | Unit | pass | not run | not run | not run |
| entries — prerender param sets for dynamic patterns > fills declared entries into the crawl list; undeclared dynamics are skipped | Unit | pass | not run | not run | not run |
| href — rename-safe links off the table keys > fills params + prefixes base | Unit | pass | not run | not run | not run |
| loads — memoization + parent-sharing (no waterfall, no waste) > a shared load runs ONCE per request even when two loads await it | Unit | pass | not run | not run | not run |
| loads — memoization + parent-sharing (no waterfall, no waste) > memo is per-request (a second request re-runs) | Unit | pass | not run | not run | not run |
| miss — HTML boundary for page requests > unmatched NON-HTML request keeps the JSON 404 (fetch/API callers) | Unit | pass | not run | not run | not run |
| miss — HTML boundary for page requests > unmatched page GET under a base renders the root error page as HTML 404 | Unit | pass | not run | not run | not run |
packages/router/test/router-match.test.ts | |||||
| router pattern matching > distinguishes dot-suffixed and nested variants (the profiler /report cases) | Unit | pass | not run | not run | not run |
| router pattern matching > handles [...rest] (may be empty) and [[optional]] | Unit | pass | not run | not run | not run |
| router pattern matching > is trailing-slash-insensitive and decodes params | Unit | pass | not run | not run | not run |
| router pattern matching > matches root, static, and params | Unit | pass | not run | not run | not run |
| router pattern matching > orders overlapping routes static > param > rest | Unit | pass | not run | not run | not run |
| router pattern matching > REGRESSION: an empty-matching [...rest] must not shadow shorter routes | Unit | pass | not run | not run | not run |
| router pattern matching > rejects malformed patterns loudly | Unit | pass | not run | not run | not run |
packages/router/test/router-schema.test.ts | |||||
| endpoint body schema (POST/PUT/PATCH → c.input) > 400s a bad body with the issues | Unit | pass | not run | not run | not run |
| endpoint body schema (POST/PUT/PATCH → c.input) > 400s a non-JSON body | Unit | pass | not run | not run | not run |
| endpoint body schema (POST/PUT/PATCH → c.input) > GET has no body schema — path on c.params, query on c.search (three clean surfaces) | Unit | pass | not run | not run | not run |
| endpoint body schema (POST/PUT/PATCH → c.input) > validates the JSON body and types c.input | Unit | pass | not run | not run | not run |
| page-level search schema (typed search params → c.search, bad → 400) > 400s bad input with the issues, before any load runs | Unit | pass | not run | not run | not run |
| page-level search schema (typed search params → c.search, bad → 400) > applies the schema default when the param is absent (lenient) | Unit | pass | not run | not run | not run |
| page-level search schema (typed search params → c.search, bad → 400) > coerces good input into the typed c.search (string → number) | Unit | pass | not run | not run | not run |
packages/router/test/router-stream-cancel.test.ts | |||||
| a source whose cleanup fails as the visitor leaves > a page generator: request_cleanup_failed, with the error | Unit | pass | not run | not run | not run |
| a source whose cleanup fails as the visitor leaves > a source a merged stream holds: request_cleanup_failed, with the error | Unit | pass | not run | not run | not run |
| a streamed page the visitor left (#284) > cancelling a merged, drained stream ends every source it holds#284 | Unit | pass | not run | not run | not run |
| a streamed page the visitor left (#284) > cancelling the body ends the page generator and renders nothing more#284 | Unit | pass | not run | not run | not run |