Tests / @ogygia/router

@ogygia/router

Version 0.13.1
commit 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

TestKindNodeChromiumFirefoxWebKit
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’sUnitpassnot runnot runnot run
route config × programmatic router > a claimed-but-unset path shadows the file world; an unclaimed one falls through to itUnitpassnot runnot runnot run
route config × programmatic router > a page that sets nothing and an unmatched path both answer undefined (the default applies)Unitpassnot runnot runnot run
route config × programmatic router > dynamic patterns match like dispatchUnitpassnot runnot runnot run
route config × programmatic router > endpoints are not pages: claimed, nothing set, whatever the table saysUnitpassnot runnot runnot run
route config × programmatic router > nested layouts: the innermost wins over an outer oneUnitpassnot runnot runnot run
route config × programmatic router > page > layout > table — the deepest level winsUnitpassnot runnot runnot run
route config × programmatic router > re-registering the same table REPLACES its matcher (dev re-evaluation), never shadows itUnitpassnot runnot runnot run
route config × programmatic router > the merge is per key: a deeper config without the key keeps the outer valueUnitpassnot runnot runnot run
route config × programmatic router > two mounted tables: the one that claims the path answersUnitpassnot runnot runnot 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 undefinedUnitpassnot runnot runnot run
api() — the typed endpoint client > a null return answers 204 → resolves undefinedUnitpassnot runnot runnot run
api() — the typed endpoint client > a schema 400 throws ApiError carrying the issues bodyUnitpassnot runnot runnot run
api() — the typed endpoint client > an unmatched path throws ApiError 404Unitpassnot runnot runnot run
api() — the typed endpoint client > fills the pattern, carries the query, parses the typed payloadUnitpassnot runnot runnot run
api() — the typed endpoint client > POSTs the schema-typed body; the payload comes back typedUnitpassnot runnot runnot run
packages/router/test/router-dispatch.test.ts
dispatch — base, slash, miss > 308-canonicalizes a trailing slash under slash:neverUnitpassnot runnot runnot run
dispatch — base, slash, miss > runs miss for an unmatched path under baseUnitpassnot runnot runnot run
dispatch — base, slash, miss > strips base, returns null for out-of-baseUnitpassnot runnot runnot run
dispatch — c.setHeaders reaches router-built responses > applies collected headers to the built responseUnitpassnot runnot runnot run
dispatch — c.setHeaders reaches router-built responses > never clobbers headers the handler set explicitlyUnitpassnot runnot runnot run
dispatch — endpoints, params, verbs > dispatches verbs, 405s the rest with allow, answers OPTIONSUnitpassnot runnot runnot run
dispatch — endpoints, params, verbs > falls through (null) on no match when unbasedUnitpassnot runnot runnot run
dispatch — endpoints, params, verbs > routes GET endpoints with params ([slug], [...rest])Unitpassnot runnot runnot run
dispatch — thrown redirect / error > error() from an endpoint → JSON errorUnitpassnot runnot runnot run
dispatch — thrown redirect / error > redirect() → a redirect responseUnitpassnot runnot runnot run
entries — prerender param sets for dynamic patterns > fills declared entries into the crawl list; undeclared dynamics are skippedUnitpassnot runnot runnot run
href — rename-safe links off the table keys > fills params + prefixes baseUnitpassnot runnot runnot run
loads — memoization + parent-sharing (no waterfall, no waste) > a shared load runs ONCE per request even when two loads await itUnitpassnot runnot runnot run
loads — memoization + parent-sharing (no waterfall, no waste) > memo is per-request (a second request re-runs)Unitpassnot runnot runnot run
miss — HTML boundary for page requests > unmatched NON-HTML request keeps the JSON 404 (fetch/API callers)Unitpassnot runnot runnot run
miss — HTML boundary for page requests > unmatched page GET under a base renders the root error page as HTML 404Unitpassnot runnot runnot run
packages/router/test/router-match.test.ts
router pattern matching > distinguishes dot-suffixed and nested variants (the profiler /report cases)Unitpassnot runnot runnot run
router pattern matching > handles [...rest] (may be empty) and [[optional]]Unitpassnot runnot runnot run
router pattern matching > is trailing-slash-insensitive and decodes paramsUnitpassnot runnot runnot run
router pattern matching > matches root, static, and paramsUnitpassnot runnot runnot run
router pattern matching > orders overlapping routes static > param > restUnitpassnot runnot runnot run
router pattern matching > REGRESSION: an empty-matching [...rest] must not shadow shorter routesUnitpassnot runnot runnot run
router pattern matching > rejects malformed patterns loudlyUnitpassnot runnot runnot run
packages/router/test/router-schema.test.ts
endpoint body schema (POST/PUT/PATCH → c.input) > 400s a bad body with the issuesUnitpassnot runnot runnot run
endpoint body schema (POST/PUT/PATCH → c.input) > 400s a non-JSON bodyUnitpassnot runnot runnot 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)Unitpassnot runnot runnot run
endpoint body schema (POST/PUT/PATCH → c.input) > validates the JSON body and types c.inputUnitpassnot runnot runnot run
page-level search schema (typed search params → c.search, bad → 400) > 400s bad input with the issues, before any load runsUnitpassnot runnot runnot run
page-level search schema (typed search params → c.search, bad → 400) > applies the schema default when the param is absent (lenient)Unitpassnot runnot runnot run
page-level search schema (typed search params → c.search, bad → 400) > coerces good input into the typed c.search (string → number)Unitpassnot runnot runnot 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 errorUnitpassnot runnot runnot run
a source whose cleanup fails as the visitor leaves > a source a merged stream holds: request_cleanup_failed, with the errorUnitpassnot runnot runnot run
a streamed page the visitor left (#284) > cancelling a merged, drained stream ends every source it holds#284Unitpassnot runnot runnot run
a streamed page the visitor left (#284) > cancelling the body ends the page generator and renders nothing more#284Unitpassnot runnot runnot run