docs: honest README + quickstart, and a Starlight documentation site
CI / build (pull_request) Has been cancelled
CI / build (pull_request) Has been cancelled
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>
This commit is contained in:
24 files changed
+8275
-7
No files matched your search
@@ -0,0 +1,33 @@
|
||||
---
|
||||
title: Testing
|
||||
description: "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:
|
||||
|
||||
```typescript
|
||||
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)`](/guides/introspection/) — explain the chain to
|
||||
see which tokens a route actually depends on, then override exactly those.
|
||||
Reference in new issue
Block a user