This version (v0.7) has not been published to npm yet.
Skip to content

Reference / @getenginex/sdk/testing / MockHandler

MockHandler ​

MockHandler = (req) => Response | Promise<Response>

Handler for a createMockFetch route: receives the request and returns the response, usually built with ok or fail.

Parameters ​

req ​

MockRequest

Returns ​

Response | Promise<Response>

Example ​

ts
const routes = { 'GET /api/v1/config': () => ok({ version: '1.0' }) } satisfies Record<string, MockHandler>