Skip to content

MockContextOpts

type MockContextOpts = unknown

Options accepted by mockContext.

All fields optional. Defaults: method = “GET”, url = ”/”, empty headers/params, no body, no pre-seeded state.

Body is raw bytes (no auto-JSON); encode explicitly with TextEncoder for parity with what a real request would carry on the wire. The integration harness (FlareTestApp.fetch + TestRequestInit) auto-JSON-serializes; this unit-level surface intentionally does not.

params and state use Map instances because route param keys and StateToken objects cannot be used as computed object-literal keys.

Learn: Unit-test a controller

Last updated: