Files
core/website/src/content/docs/guides/testing.md
T
chrnx 489aa685bb docs: host the docs at green-tea.expressive-tea.io/docs
The site hangs off the expressive-tea.io cPanel as green-tea.expressive-tea.io.
A four-level docs.green-tea.expressive-tea.io subdomain reads badly and would
need its own AutoSSL cert (the *.expressive-tea.io wildcard stops one level
up). A /docs subfolder needs no extra host, DNS, or cert — it's a path — and
is what most projects do.

So the docs site now builds with base: '/docs' (its dist/ contents drop into
the subdomain's docs/ folder in cPanel), the 77 hard-coded content links are
prefixed, and the two hero actions Starlight doesn't rewrite are fixed by
hand. Verified: /docs/ serves, / 404s, no unprefixed internal href remains.
README points at the new docs URL.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-07-17 10:13:10 -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.