testing/round_trip.ts

Schema-driven round-trip validation test suite.

For every route spec, generates a valid request (auth, params, body) and validates the response against declared output or error schemas. DB-backed via create_test_app — exercises the full middleware stack.

Declarations
#

2 declarations

view source

describe_round_trip_validation
#

testing/round_trip.ts view source

(options: RoundTripTestOptions): void

Run schema-driven round-trip validation tests.

For each route: 1. Resolve URL with valid params 2. Generate a valid request body (or use override) 3. Pick auth headers matching the route's auth requirement 4. Fire the request and validate the response against declared schemas

SSE routes are skipped (Content-Type text/event-stream). Routes returning non-2xx with valid input are still validated against their declared error schemas.

options

round-trip test configuration

returns

void

RoundTripTestOptions
#

testing/round_trip.ts view source

RoundTripTestOptions

session_options

Session config for cookie-based auth.

type SessionOptions<string>

create_route_specs

Route spec factory — same one used in production.

type (ctx: AppServerContext) => Array<RouteSpec>

app_options

Optional overrides for AppServerOptions.

type Partial< Omit<AppServerOptions, 'backend' | 'session_options' | 'create_route_specs'> >

db_factories

Database factories to run tests against. Default: pglite only.

type Array<DbFactory>

skip_routes

Routes to skip, in 'METHOD /path' format.

type Array<string>

input_overrides

Override generated bodies for specific routes ('METHOD /path' → body).

type Map<string, Record<string, unknown>>

Depends on
#