Skip to content

Follow-up to #533: capability + coverage polish for @rangojs/router/testing #542

Closed

Description

@ivogt

Follow-up to #533 (feat(testing): consumer testing primitives). The module's abstractions and core capabilities are validated (4-lens usefulness review: medium-high, "ship it"; the high-value core runs real router internals). #533 ships the message + limits (test-pyramid framing + a complete "deliberately don't cover" trap table). This issue tracks the capability + coverage polish — turning documented false-confidence traps into loud failures, and closing the biggest capability gap — so a misleading test errors instead of passing green.

1. Make silent false-confidence traps fail loud (not just documented)

These currently pass green while proving nothing:

  • renderRoute navigation frozen at idle — navigate() bypasses the lifecycle, so useNavigation/useLinkStatus/useAction non-idle states are invisible. Warn/throw when a test relies on a non-idle state.
  • "use cache" run without a seeded cacheStore — registerCachedFunction bypasses, silently exercising the uncached path. Emit a warning that the cached path is not being tested.
  • Flight getRequestContext()/cookies() alias trap — without the rsc-project rangoTestAliases, a context-reading handler hits the throwing stub and surfaces as opaque tree: undefined. Detect this and emit an actionable "add rangoTestAliases to your rsc project" error.
  • renderRoute wrong mount prefix — runtime-silent; validate the prefix against the routes.

2. Close the biggest capability gap

  • Full-app router import in bare tests — a router using Prerender()/createLoader() throws "missing $$id" (plugin-injected at build). Either support injected ids in bare tests, OR promote the Prerender-free-include recipe to the canonical quickstart dispatch/assertGeneratedRoutesMatch pattern (it is documented but mid-doc).

3. Trim / de-emphasize marginal surface

  • Steer users to renderServerTree (inspect props/boundaries) over raw renderToFlightString wire-string matchers for assertions.
  • Consolidate the dual cache-telemetry paths (parseCacheHeader/assertCacheStatus vs createCacheSink/filterCacheDecisions).

Already done in #533

  • Lead docs with the test-pyramid framing.
  • Complete the "deliberately don't cover" trap table — added rows for: "use cache" uncached-path, whole-app router import block (Prerender/$$id), and the ctx.rendered() barrier-wiring loader trap.

Relates to #533.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions