Files
core/website/src/content/docs/guides/testing.md
T
chrnx 654c0563fc
CI / build (pull_request) Has been cancelled
docs: honest README + quickstart, and a Starlight documentation site
Bring the README in line with what shipped and fill the gaps a technical
reader comparing frameworks needs: the busboy peer dep and dual build, a
Routing section with its limits, an explicit "bring your own auth" scope
note, why legacy decorators is a design choice (not laziness), and CalVer
beta versioning.

Add a full Astro Starlight docs site under website/ — getting started,
concepts, per-feature guides, and an API reference — migrated from the
tested quickstart so the examples stay accurate.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-07-07 12:02:17 -05:00

1.2 KiB

title, description
title description
Testing Swap any node with createApp overrides for fast, isolated tests.

Any provider or step is addressable by its token, so you can swap it for a test double at construction time — no monkey-patching, no module rewiring.

Override tokens in tests

Pass overrides to createApp. Each key is a token; each value is either a plain object (wrapped as { token: value }) or a function runner:

const app = createApp({
  modules: [ApiModule],
  overrides: {
    db: { find: () => ({ id: 'test-user' }) },   // plain object — wrapped as { db: value }
    user: () => ({ user: { id: 'stub' } }),       // function runner
  },
});

Overrides replace only the named token's runner; the rest of the graph is untouched. The route still runs its full closure — you've just substituted what one node produces.

:::note An override for an unknown token throws. The set of tokens is validated against the real graph, so a typo'd or stale override is a construction-time error, not a silent no-op. :::

This pairs well with app.explain(route) — explain the chain to see which tokens a route actually depends on, then override exactly those.