Connectum API Reference / @connectum/testing / index / createMockNext
Function: createMockNext() ​
createMockNext(
options?):any
Defined in: test-fixtures/dist/index.d.ts:267
Create a mock next handler that resolves with a successful response.
The returned function is a spy (via createMockFn), so callers can inspect next.mock.calls and next.mock.callCount() after the test.
Parameters ​
options? ​
Optional overrides for the response payload and stream flag.
Returns ​
any
A spy-enabled async function matching the ConnectRPC next signature.
Example ​
ts
import { createMockNext } from "@connectum/testing";
const next = createMockNext({ message: { id: 1 } });
const res = await next({});
// res.message => { id: 1 }
// next.mock.callCount() => 1