testing/transports/surface_source.ts

Discriminated source for the AppSurface a suite asserts against.

In-process callers pass {kind: 'inline', spec} — the full AppSurfaceSpec with route closures intact. Cross-process callers pass {kind: 'snapshot', path} — a committed JSON file containing only the JSON-serializable AppSurface shape.

Backs the suite parameter that previously was build: () => AppSurfaceSpec.

Declarations
#

2 declarations

view source

resolve_surface_source
#

testing/transports/surface_source.ts view source

(src: SurfaceSource): Promise<AppSurface | AppSurfaceSpec>

Resolve a SurfaceSource to the underlying surface shape.

The inline variant returns the full AppSurfaceSpec (route closures available). The snapshot variant returns the serialized AppSurface shape only. Asymmetric on purpose — suites that need route_specs (with closures) must use the inline variant; suites working on the AppSurface shape work with either.

src

returns

Promise<AppSurface | AppSurfaceSpec>

throws

  • Error - when called with `{kind: 'snapshot'}` — the snapshot

SurfaceSource
#

testing/transports/surface_source.ts view source

SurfaceSource

Where a suite reads the AppSurface from for its assertions.

Two variants. The inline variant carries the full AppSurfaceSpec (with route closures) — the only variant in-process suites can use for route-iteration tests, since route closures aren't JSON-serializable. The snapshot variant carries a path to a committed JSON file containing the AppSurface shape only — cross-process consumers use this to assert against a backend that doesn't share TS handler closures.

No 'fetched' (live /api/surface endpoint) variant: a dead union case is dead weight and a code-shaped invitation to add a debug endpoint the design explicitly rejected; committed snapshot is the contract.

Depends on
#