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

Reference / @getenginex/sdk/testing / ok

ok() ​

ok(data, meta?, status?): Response

Success response in the gateway format ({ success: true, data, meta? }), ready for a MockHandler handler. status defaults to 200; use 201 to mimic creation routes.

Parameters ​

data ​

unknown

meta? ​

Record<string, unknown>

status? ​

number = 200

Returns ​

Response

Examples ​

ts
createMockFetch({ routes: { 'GET /api/v1/config/products': () => ok({ products: [] }) } })
ts
createMockFetch({ routes: { 'POST /api/v1/pix-keys': () => ok({ id: 'pk-1' }, undefined, 201) } })